Example usage for java.lang SecurityException getMessage

List of usage examples for java.lang SecurityException getMessage

Introduction

In this page you can find the example usage for java.lang SecurityException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.cws.esolutions.security.processors.impl.AccountChangeProcessorImpl.java

/**
 * @see com.cws.esolutions.security.processors.interfaces.IAccountChangeProcessor#changeUserEmail(com.cws.esolutions.security.processors.dto.AccountChangeRequest)
 *///w w w . ja v  a 2 s . c  o m
public AccountChangeResponse changeUserEmail(final AccountChangeRequest request) throws AccountChangeException {
    final String methodName = IAccountChangeProcessor.CNAME
            + "#changeUserEmail(final AccountChangeRequest request) throws AccountChangeException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("AccountChangeRequest: {}", request);
    }

    AccountChangeResponse response = new AccountChangeResponse();

    final RequestHostInfo reqInfo = request.getHostInfo();
    final UserAccount requestor = request.getRequestor();
    final UserAccount userAccount = request.getUserAccount();
    final AuthenticationData reqSecurity = request.getUserSecurity();

    if (DEBUG) {
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
        DEBUGGER.debug("UserAccount: {}", requestor);
        DEBUGGER.debug("UserAccount: {}", userAccount);
    }

    // ok, first things first. if this is an administrative reset, make sure the requesting user
    // is authorized to perform the action.
    if (!(StringUtils.equals(userAccount.getGuid(), requestor.getGuid()))) {
        // requesting user is not the same as the user being reset. no authorization here,
        // no one is allowed to change user security but the owning user
        response.setRequestStatus(SecurityRequestStatus.UNAUTHORIZED);

        return response;
    }

    try {
        // ok, authenticate first
        String userSalt = userSec.getUserSalt(userAccount.getGuid(), SaltType.LOGON.name());

        if (StringUtils.isNotEmpty(userSalt)) {
            // we aren't getting the data back here because we don't need it. if the request
            // fails we'll get an exception and not process further. this might not be the
            // best flow control, but it does exactly what we need where we need it.
            authenticator.performLogon(userAccount.getUsername(),
                    PasswordUtils.encryptText(reqSecurity.getPassword(), userSalt,
                            secBean.getConfigData().getSecurityConfig().getAuthAlgorithm(),
                            secBean.getConfigData().getSecurityConfig().getIterations(),
                            secBean.getConfigData().getSystemConfig().getEncoding()));

            boolean isComplete = userManager.modifyUserEmail(userAccount.getUsername(),
                    userAccount.getEmailAddr());

            if (isComplete) {
                UserAccount retAccount = userAccount;
                retAccount.setEmailAddr(userAccount.getEmailAddr());

                response.setUserAccount(retAccount);
                response.setRequestStatus(SecurityRequestStatus.SUCCESS);
            } else {
                response.setRequestStatus(SecurityRequestStatus.FAILURE);
            }
        } else {
            throw new AccountChangeException("Unable to obtain configured user salt. Cannot continue");
        }
    } catch (SQLException sqx) {
        ERROR_RECORDER.error(sqx.getMessage(), sqx);

        throw new AccountChangeException(sqx.getMessage(), sqx);
    } catch (AuthenticatorException ax) {
        ERROR_RECORDER.error(ax.getMessage(), ax);

        throw new AccountChangeException(ax.getMessage(), ax);
    } catch (UserManagementException umx) {
        ERROR_RECORDER.error(umx.getMessage(), umx);

        throw new AccountChangeException(umx.getMessage(), umx);
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new AccountChangeException(sx.getMessage(), sx);
    } finally {
        // audit
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.MODIFYUSER);
            auditEntry.setUserAccount(requestor);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:com.cws.esolutions.security.processors.impl.AccountChangeProcessorImpl.java

/**
 * @see com.cws.esolutions.security.processors.interfaces.IAccountChangeProcessor#changeUserContact(com.cws.esolutions.security.processors.dto.AccountChangeRequest)
 *//*from  w  w w  . jav  a 2  s .  c o  m*/
public AccountChangeResponse changeUserContact(final AccountChangeRequest request)
        throws AccountChangeException {
    final String methodName = IAccountChangeProcessor.CNAME
            + "#changeUserContact(final AccountChangeRequest request) throws AccountChangeException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("AccountChangeRequest: {}", request);
    }

    AccountChangeResponse response = new AccountChangeResponse();

    final RequestHostInfo reqInfo = request.getHostInfo();
    final UserAccount requestor = request.getRequestor();
    final UserAccount userAccount = request.getUserAccount();
    final AuthenticationData reqSecurity = request.getUserSecurity();

    if (DEBUG) {
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
        DEBUGGER.debug("UserAccount: {}", requestor);
        DEBUGGER.debug("UserAccount: {}", userAccount);
    }

    // ok, first things first. if this is an administrative reset, make sure the requesting user
    // is authorized to perform the action.
    if (!(StringUtils.equals(userAccount.getGuid(), requestor.getGuid()))) {
        // requesting user is not the same as the user being reset. no authorization here,
        // no one is allowed to change user security but the owning user
        response.setRequestStatus(SecurityRequestStatus.UNAUTHORIZED);

        return response;
    }

    try {
        // ok, authenticate first
        String userSalt = userSec.getUserSalt(userAccount.getGuid(), SaltType.LOGON.name());

        if (StringUtils.isNotEmpty(userSalt)) {
            // we aren't getting the data back here because we don't need it. if the request
            // fails we'll get an exception and not process further. this might not be the
            // best flow control, but it does exactly what we need where we need it.
            authenticator.performLogon(userAccount.getUsername(),
                    PasswordUtils.encryptText(reqSecurity.getPassword(), userSalt,
                            secBean.getConfigData().getSecurityConfig().getAuthAlgorithm(),
                            secBean.getConfigData().getSecurityConfig().getIterations(),
                            secBean.getConfigData().getSystemConfig().getEncoding()));

            boolean isComplete = userManager.modifyUserContact(userAccount.getUsername(), new ArrayList<String>(
                    Arrays.asList(userAccount.getTelephoneNumber(), userAccount.getPagerNumber())));

            if (isComplete) {
                UserAccount retAccount = userAccount;
                retAccount.setTelephoneNumber(userAccount.getTelephoneNumber());
                retAccount.setPagerNumber(userAccount.getPagerNumber());

                response.setUserAccount(retAccount);
                response.setRequestStatus(SecurityRequestStatus.SUCCESS);
            } else {
                response.setRequestStatus(SecurityRequestStatus.FAILURE);
            }
        } else {
            throw new AccountChangeException("Unable to obtain configured user salt. Cannot continue");
        }
    } catch (SQLException sqx) {
        ERROR_RECORDER.error(sqx.getMessage(), sqx);

        throw new AccountChangeException(sqx.getMessage(), sqx);
    } catch (AuthenticatorException ax) {
        ERROR_RECORDER.error(ax.getMessage(), ax);

        throw new AccountChangeException(ax.getMessage(), ax);
    } catch (UserManagementException umx) {
        ERROR_RECORDER.error(umx.getMessage(), umx);

        throw new AccountChangeException(umx.getMessage(), umx);
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new AccountChangeException(sx.getMessage(), sx);
    } finally {
        // audit
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.MODIFYUSER);
            auditEntry.setUserAccount(requestor);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:org.cloudifysource.rest.controllers.TemplatesController.java

/**
 * Deletes the template's file. Deletes the templates folder if no other templates files exist in the folder.
 * Deletes the {@link CloudifyConstants#ADDITIONAL_TEMPLATES_FOLDER_NAME} folder if empty.
 * /* w ww.ja va  2 s. c  om*/
 * @param templateName
 * @throws RestErrorException
 */
private void deleteTemplateFile(final String templateName) throws RestErrorException {
    final File templateFolder = getTemplateFolder(templateName);
    if (templateFolder == null) {
        throw new RestErrorException(CloudifyErrorMessages.FAILED_REMOVE_TEMPLATE_FILE.getName(), templateName,
                "failed to get template's folder");
    }
    final File templateFile = getTemplateFile(templateName, templateFolder);
    if (templateFile == null) {
        throw new RestErrorException(CloudifyErrorMessages.FAILED_REMOVE_TEMPLATE_FILE.getName(), templateName,
                "template file doesn't exist");
    }
    // delete the file from the directory.
    final String templatesPath = templateFile.getAbsolutePath();
    log(Level.FINE, "[deleteTemplateFile] - removing template file " + templatesPath);

    boolean deleted = false;
    try {
        deleted = templateFile.delete();
    } catch (final SecurityException e) {
        log(Level.WARNING, "[deleteTemplateFile] - Failed to deleted template file " + templatesPath
                + ", Error: " + e.getMessage(), e);
        throw new RestErrorException(CloudifyErrorMessages.FAILED_REMOVE_TEMPLATE_FILE.getName(), templatesPath,
                "Security exception: " + e.getMessage());
    }
    if (!deleted) {
        throw new RestErrorException(CloudifyErrorMessages.FAILED_REMOVE_TEMPLATE_FILE.getName(), templatesPath,
                "template file was not deleted.");
    }
    log(Level.FINE, "[deleteTemplateFile] - Successfully deleted template file [" + templatesPath + "].");
    // delete properties and overrides files if exist.
    ComputeTemplatesReader.removeTemplateFiles(templateFolder, templateName);
    deleteTemplateFolderIfNeeded(templateName, templateFolder);
}

From source file:com.cws.esolutions.security.processors.impl.AccountChangeProcessorImpl.java

/**
 * @see com.cws.esolutions.security.processors.interfaces.IAccountChangeProcessor#disableOtpAuth(com.cws.esolutions.security.processors.dto.AccountChangeRequest)
 *//*from  w ww. j  av  a2  s. com*/
public AccountChangeResponse disableOtpAuth(final AccountChangeRequest request) throws AccountChangeException {
    final String methodName = IAccountChangeProcessor.CNAME
            + "#disableOtpAuth(final AccountChangeRequest request) throws AccountChangeException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("AccountChangeRequest: {}", request);
    }

    AccountChangeResponse response = new AccountChangeResponse();

    final UserAccount requestor = request.getRequestor();
    final RequestHostInfo reqInfo = request.getHostInfo();
    final UserAccount userAccount = request.getUserAccount();
    final AuthenticationData reqSecurity = request.getUserSecurity();

    if (DEBUG) {
        DEBUGGER.debug("UserAccount: {}", userAccount);
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
        DEBUGGER.debug("UserAccount: {}", userAccount);
    }

    if (!(StringUtils.equals(userAccount.getGuid(), requestor.getGuid()))) {
        // requesting user is not the same as the user being reset. authorize
        response.setRequestStatus(SecurityRequestStatus.UNAUTHORIZED);

        return response;
    }

    try {
        String userSalt = userSec.getUserSalt(userAccount.getGuid(), SaltType.LOGON.name());

        if (StringUtils.isNotEmpty(userSalt)) {
            // we aren't getting the data back here because we don't need it. if the request
            // fails we'll get an exception and not process further. this might not be the
            // best flow control, but it does exactly what we need where we need it.
            authenticator.performLogon(userAccount.getUsername(),
                    PasswordUtils.encryptText(reqSecurity.getPassword(), userSalt,
                            secBean.getConfigData().getSecurityConfig().getAuthAlgorithm(),
                            secBean.getConfigData().getSecurityConfig().getIterations(),
                            secBean.getConfigData().getSystemConfig().getEncoding()));

            // delete entries here
            boolean isSecretRemoved = userManager.modifyOtpSecret(userAccount.getGuid(), false, null);

            if (DEBUG) {
                DEBUGGER.debug("isSecretRemoved: {}", isSecretRemoved);
            }

            if (!(isSecretRemoved)) {
                response.setRequestStatus(SecurityRequestStatus.FAILURE);

                return response;
            }

            boolean isSaltRemoved = userSec.removeUserData(userAccount.getGuid(), SaltType.OTP.name());

            if (DEBUG) {
                DEBUGGER.debug("isSaltRemoved: {}", isSaltRemoved);
            }

            if (!(isSaltRemoved)) {
                response.setRequestStatus(SecurityRequestStatus.FAILURE);

                return response;
            }

            response.setRequestStatus(SecurityRequestStatus.SUCCESS);
        } else {
            ERROR_RECORDER.error("Unable to obtain configured user salt. Cannot continue");

            response.setRequestStatus(SecurityRequestStatus.FAILURE);
        }
    } catch (SQLException sqx) {
        ERROR_RECORDER.error(sqx.getMessage(), sqx);

        throw new AccountChangeException(sqx.getMessage(), sqx);
    } catch (AuthenticatorException ax) {
        ERROR_RECORDER.error(ax.getMessage(), ax);

        throw new AccountChangeException(ax.getMessage(), ax);
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new SecurityException(sx.getMessage(), sx);
    } catch (UserManagementException umx) {
        ERROR_RECORDER.error(umx.getMessage(), umx);

        throw new SecurityException(umx.getMessage(), umx);
    } finally {
        // audit
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.CHANGEKEYS);
            auditEntry.setUserAccount(userAccount);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:org.sakaiproject.assignment2.logic.impl.ExternalGradebookLogicImpl.java

public void saveGradesAndComments(String contextId, Long gradebookItemId,
        List<GradeInformation> gradeInfoList) {
    if (contextId == null || gradebookItemId == null) {
        throw new IllegalArgumentException("Null contextId or gradebookItemId "
                + "passed to saveGradesAndCommentsForSubmissions. contextId:" + contextId + " gradebookItemId:"
                + gradebookItemId);//from w  w  w . j  a v  a  2  s.c o  m
    }

    List<GradeDefinition> gradeDefList = new ArrayList<GradeDefinition>();

    if (gradeInfoList != null) {
        for (GradeInformation gradeInfo : gradeInfoList) {
            if (gradeInfo != null) {
                // double check that we weren't passed submissions for 
                // different assignments - we don't want to update the wrong grades!
                Long assignGo = gradeInfo.getGradebookItemId();
                if (assignGo == null || !assignGo.equals(gradebookItemId)) {
                    throw new IllegalArgumentException("The given submission's gradebookItemId " + assignGo
                            + " does not match the goId passed to saveGradesAndCommentsForSubmissions: "
                            + gradebookItemId);
                }

                // convert the info into a GradeDefinition
                GradeDefinition gradeDef = new GradeDefinition();
                gradeDef.setGrade(gradeInfo.getGradebookGrade());
                gradeDef.setGradeComment(gradeInfo.getGradebookComment());
                gradeDef.setStudentUid(gradeInfo.getStudentId());

                gradeDefList.add(gradeDef);
            }
        }

        // now try to save the new information
        try {
            gradebookService.saveGradesAndComments(contextId, gradebookItemId, gradeDefList);
            if (log.isDebugEnabled())
                log.debug("Grades and comments for contextId " + contextId + " for gbItem " + gradebookItemId
                        + "updated successfully for " + gradeDefList.size() + " students");
        } catch (GradebookNotFoundException gnfe) {
            throw new NoGradebookDataExistsException("No gradebook exists in the given context " + contextId,
                    gnfe);
        } catch (AssessmentNotFoundException anfe) {
            throw new GradebookItemNotFoundException(
                    "No gradebook item exists with the given id " + gradebookItemId, anfe);
        } catch (InvalidGradeException ige) {
            throw new InvalidGradeForAssignmentException("Attempted to save an invalid grade in gradebook "
                    + contextId + " via saveGradesAndCommentsForSubmissions. "
                    + "No grade information was updated.", ige);
        } catch (SecurityException se) {
            throw new SecurityException("The current user attempted to saveGradeAndCommentForStudent "
                    + "without authorization. Error: " + se.getMessage(), se);
        }
    }
}

From source file:com.cws.esolutions.security.processors.impl.AccountChangeProcessorImpl.java

/**
 * @see com.cws.esolutions.security.processors.interfaces.IAccountChangeProcessor#enableOtpAuth(com.cws.esolutions.security.processors.dto.AccountChangeRequest)
 *//*from w w w  . ja v  a 2 s  .  c o m*/
public AccountChangeResponse enableOtpAuth(final AccountChangeRequest request) throws AccountChangeException {
    final String methodName = IAccountChangeProcessor.CNAME
            + "#enableOtpAuth(final AccountChangeRequest request) throws AccountChangeException";

    if (DEBUG) {
        DEBUGGER.debug(methodName);
        DEBUGGER.debug("AccountChangeRequest: {}", request);
    }

    AccountChangeResponse response = new AccountChangeResponse();

    final UserAccount requestor = request.getRequestor();
    final RequestHostInfo reqInfo = request.getHostInfo();
    final UserAccount userAccount = request.getUserAccount();
    final AuthenticationData reqSecurity = request.getUserSecurity();

    if (DEBUG) {
        DEBUGGER.debug("UserAccount: {}", userAccount);
        DEBUGGER.debug("RequestHostInfo: {}", reqInfo);
        DEBUGGER.debug("UserAccount: {}", userAccount);
    }

    if (!(StringUtils.equals(userAccount.getGuid(), requestor.getGuid()))) {
        // requesting user is not the same as the user being reset. authorize
        response.setRequestStatus(SecurityRequestStatus.UNAUTHORIZED);

        return response;
    }

    try {
        String userSalt = userSec.getUserSalt(userAccount.getGuid(), SaltType.LOGON.name());

        if (StringUtils.isNotEmpty(userSalt)) {
            // we aren't getting the data back here because we don't need it. if the request
            // fails we'll get an exception and not process further. this might not be the
            // best flow control, but it does exactly what we need where we need it.
            authenticator.performLogon(userAccount.getUsername(),
                    PasswordUtils.encryptText(reqSecurity.getPassword(), userSalt,
                            secBean.getConfigData().getSecurityConfig().getAuthAlgorithm(),
                            secBean.getConfigData().getSecurityConfig().getIterations(),
                            secBean.getConfigData().getSystemConfig().getEncoding()));

            String secret = new String(
                    new Base32().encode(RandomStringUtils.randomAlphanumeric(10).getBytes()));

            if (DEBUG) {
                DEBUGGER.debug("String: {}", secret);
            }

            String otpSalt = RandomStringUtils.randomAlphanumeric(secConfig.getSaltLength());

            if (StringUtils.isNotEmpty(otpSalt)) {
                boolean isSaltInserted = userSec.addOrUpdateSalt(userAccount.getGuid(), otpSalt,
                        SaltType.OTP.name());

                if (DEBUG) {
                    DEBUGGER.debug("isSaltInserted: {}", isSaltInserted);
                }

                if ((!isSaltInserted)) {
                    response.setRequestStatus(SecurityRequestStatus.FAILURE);

                    return response;
                }

                boolean isComplete = userManager.modifyOtpSecret(userAccount.getUsername(), true,
                        PasswordUtils.encryptText(secret, otpSalt,
                                secBean.getConfigData().getSecurityConfig().getSecretAlgorithm(),
                                secBean.getConfigData().getSecurityConfig().getIterations(),
                                secBean.getConfigData().getSecurityConfig().getKeyBits(),
                                secBean.getConfigData().getSecurityConfig().getEncryptionAlgorithm(),
                                secBean.getConfigData().getSecurityConfig().getEncryptionInstance(),
                                secBean.getConfigData().getSystemConfig().getEncoding()));

                if (DEBUG) {
                    DEBUGGER.debug("isComplete: {}", isComplete);
                }

                if (!(isComplete)) {
                    response.setRequestStatus(SecurityRequestStatus.FAILURE);

                    return response;
                }

                String qrCodeData = String.format(IAccountChangeProcessor.KEY_URI_FORMAT,
                        userAccount.getUsername(), secret, request.getApplicationName(),
                        secConfig.getOtpAlgorithm());

                if (DEBUG) {
                    DEBUGGER.debug("qrCodeData: {}", qrCodeData);
                }

                ByteArrayOutputStream qrCode = QRCode.from(qrCodeData.trim()).to(ImageType.PNG).stream();

                if (DEBUG) {
                    DEBUGGER.debug("ByteArrayOutputStream: {}", qrCode);
                }

                response.setSecret(secret);
                response.setQrCode(qrCode);
                response.setRequestStatus(SecurityRequestStatus.SUCCESS);
            } else {
                response.setRequestStatus(SecurityRequestStatus.FAILURE);
            }
        } else {
            ERROR_RECORDER.error("Unable to obtain configured user salt. Cannot continue");

            response.setRequestStatus(SecurityRequestStatus.FAILURE);
        }
    } catch (SQLException sqx) {
        ERROR_RECORDER.error(sqx.getMessage(), sqx);

        throw new AccountChangeException(sqx.getMessage(), sqx);
    } catch (AuthenticatorException ax) {
        ERROR_RECORDER.error(ax.getMessage(), ax);

        throw new AccountChangeException(ax.getMessage(), ax);
    } catch (SecurityException sx) {
        ERROR_RECORDER.error(sx.getMessage(), sx);

        throw new SecurityException(sx.getMessage(), sx);
    } catch (UserManagementException umx) {
        ERROR_RECORDER.error(umx.getMessage(), umx);

        throw new SecurityException(umx.getMessage(), umx);
    } finally {
        // audit
        try {
            AuditEntry auditEntry = new AuditEntry();
            auditEntry.setHostInfo(reqInfo);
            auditEntry.setAuditType(AuditType.CHANGEKEYS);
            auditEntry.setUserAccount(userAccount);
            auditEntry.setAuthorized(Boolean.TRUE);
            auditEntry.setApplicationId(request.getApplicationId());
            auditEntry.setApplicationName(request.getApplicationName());

            if (DEBUG) {
                DEBUGGER.debug("AuditEntry: {}", auditEntry);
            }

            AuditRequest auditRequest = new AuditRequest();
            auditRequest.setAuditEntry(auditEntry);

            if (DEBUG) {
                DEBUGGER.debug("AuditRequest: {}", auditRequest);
            }

            auditor.auditRequest(auditRequest);
        } catch (AuditServiceException asx) {
            ERROR_RECORDER.error(asx.getMessage(), asx);
        }
    }

    return response;
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void lockUser() {
    try {/*from   ww  w . ja v a  2 s .c  o  m*/
        ReaderUtil.clearScreen();
        System.out.println("Enter userId");
        String userId = ReaderUtil.readLn();
        User user = new User();
        user.setUserId(userId);
        am.lockUserAccount(user);
        System.out.println("userId [" + userId + "]");
        System.out.println("has been locked");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("lockUser caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void deleteRole() {
    Role re = new Role();

    try {/*from   w w  w . ja va 2s.  c  o m*/
        ReaderUtil.clearScreen();
        System.out.println("Enter role name:");
        re.setName(ReaderUtil.readLn());
        am.deleteRole(re);
        System.out.println("name [" + re.getName() + "]");
        System.out.println("has been deleted");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("deleteRole caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void unlockUser() {
    try {//from   www . j  a v  a 2 s .  c  o  m
        ReaderUtil.clearScreen();
        System.out.println("Enter userId");
        String userId = ReaderUtil.readLn();
        User user = new User();
        user.setUserId(userId);
        am.unlockUserAccount(user);
        System.out.println("userId [" + userId + "]");
        System.out.println("has been unlocked");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("unlockUser caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void addRole() {
    Role re = new Role();

    try {/*from  ww w. ja  v  a  2s. c o  m*/
        ReaderUtil.clearScreen();
        System.out.println("Enter role name:");
        re.setName(ReaderUtil.readLn());
        System.out.println("Enter Role's description field");
        re.setDescription(ReaderUtil.readLn());

        Role re2 = am.addRole(re);
        System.out.println("name [" + re2.getName() + "]");
        System.out.println("internalId [" + re2.getId() + "]");
        System.out.println("name description [" + re2.getDescription() + "]");
        System.out.println("has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addRole caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}