Java Code Examples for org.wso2.carbon.identity.base.IdentityException#getMessage()

The following examples show how to use org.wso2.carbon.identity.base.IdentityException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserIdentityManagementUtil.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
public static UserChallengesDTO getCustomErrorMessagesForChallengQuestions(IdentityException e, String userName) {
    if (e.getMessage() != null) {
        if (e.getMessage().contains(VerificationBean.ERROR_CODE_EXPIRED_CODE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_EXPIRED_CODE + " The code is " +
                    "expired", e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE, e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE + ": " + userName, e);
        }
        return userChallengesDTO;
    } else {
        userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE + ": " + userName, e);
        return userChallengesDTO;
    }
}
 
Example 2
Source File: UserIdentityManagementUtil.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
public static UserChallengesCollectionDTO getCustomErrorMessagesForChallengeQuestionSet(IdentityException e, String userName) {
    if (e.getMessage() != null) {
        if (e.getMessage().contains(VerificationBean.ERROR_CODE_EXPIRED_CODE)) {
            userChallengesCollectionDTO = handleChallengeQuestionSetError(VerificationBean.ERROR_CODE_EXPIRED_CODE + " The code is " +
                    "expired", e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE)) {
            userChallengesCollectionDTO = handleChallengeQuestionSetError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                                                                   IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE,
                                                                   e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            userChallengesCollectionDTO = handleChallengeQuestionSetError(
                    VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            userChallengesCollectionDTO = handleChallengeQuestionSetError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                                                                   IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE +
                                                                   ": " + userName, e);
        }
    } else {
        userChallengesCollectionDTO = handleChallengeQuestionSetError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                                                            IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE +
                                                            ": " + userName, e);
    }

    return userChallengesCollectionDTO;
}
 
Example 3
Source File: UserIdentityManagementUtil.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
public static UserChallengesDTO getCustomErrorMessagesForChallengQuestions(IdentityException e, String userName) {
    if (e.getMessage() != null) {
        if (e.getMessage().contains(VerificationBean.ERROR_CODE_EXPIRED_CODE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_EXPIRED_CODE + " The code is " +
                    "expired", e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE, e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE + ": " + userName, e);
        }
        return userChallengesDTO;
    } else {
        userChallengesDTO = handleChallengesError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE + ": " + userName, e);
        return userChallengesDTO;
    }
}
 
Example 4
Source File: SAMLApplicationDAOImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void removeServiceProviderConfiguration(String issuer) throws IdentityApplicationManagementException {
    try {
        IdentityPersistenceManager persistenceManager = IdentityPersistenceManager.getPersistanceManager();
        Registry configSystemRegistry = (Registry) PrivilegedCarbonContext.getThreadLocalCarbonContext().
                getRegistry(RegistryType.SYSTEM_CONFIGURATION);
        persistenceManager.removeServiceProvider(configSystemRegistry, issuer);
    } catch (IdentityException e) {
        log.error("Erro while deleting the issuer", e);
        throw new IdentityApplicationManagementException("Error while deleting SAML issuer " + e.getMessage());
    }
}
 
Example 5
Source File: UserIdentityManagementUtil.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public static VerificationBean getCustomErrorMessagesToVerifyCode(IdentityException e, String userName) {
    if (e.getMessage() != null) {
        if (e.getMessage().contains(VerificationBean.ERROR_CODE_EXPIRED_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_EXPIRED_CODE + " The code is " + "expired", e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE, e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE + ": " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.NOTIFICATION_FAILURE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_RECOVERY_NOTIFICATION_FAILURE + " " + IdentityMgtConstants.
                    ErrorHandling.NOTIFICATION_FAILURE + ": " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.ERROR_LOADING_EMAIL_TEMP)) {
            vBean = handleError(VerificationBean.ERROR_CODE_RECOVERY_NOTIFICATION_FAILURE + ": " + IdentityMgtConstants.
                    ErrorHandling.ERROR_LOADING_EMAIL_TEMP + " " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + ": " + IdentityMgtConstants.
                    ErrorHandling.EXTERNAL_CODE + " " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.CREATING_NOTIFICATION_ERROR)) {
            vBean = handleError(VerificationBean.ERROR_CODE_RECOVERY_NOTIFICATION_FAILURE + ": " + IdentityMgtConstants.
                    ErrorHandling.CREATING_NOTIFICATION_ERROR + " " + userName, e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.USER_ACCOUNT)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " No user account found for user", e);
        }
        return vBean;
    } else {
        vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " No user account found for user", e);
        return vBean;
    }
}
 
Example 6
Source File: SAMLApplicationDAOImpl.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public void removeServiceProviderConfiguration(String issuer) throws IdentityApplicationManagementException {
    try {
        IdentityPersistenceManager persistenceManager = IdentityPersistenceManager.getPersistanceManager();
        Registry configSystemRegistry = (Registry) PrivilegedCarbonContext.getThreadLocalCarbonContext().
                getRegistry(RegistryType.SYSTEM_CONFIGURATION);
        persistenceManager.removeServiceProvider(configSystemRegistry, issuer);
    } catch (IdentityException e) {
        log.error("Erro while deleting the issuer", e);
        throw new IdentityApplicationManagementException("Error while deleting SAML issuer " + e.getMessage());
    }
}
 
Example 7
Source File: UserIdentityManagementUtil.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public static VerificationBean getCustomErrorMessagesToVerifyCode(IdentityException e, String userName) {
    if (e.getMessage() != null) {
        if (e.getMessage().contains(VerificationBean.ERROR_CODE_EXPIRED_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_EXPIRED_CODE + " The code is " + "expired", e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.INVALID_CONFIRMATION_CODE, e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " " +
                    IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE + ": " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.NOTIFICATION_FAILURE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_RECOVERY_NOTIFICATION_FAILURE + " " + IdentityMgtConstants.
                    ErrorHandling.NOTIFICATION_FAILURE + ": " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.ERROR_LOADING_EMAIL_TEMP)) {
            vBean = handleError(VerificationBean.ERROR_CODE_RECOVERY_NOTIFICATION_FAILURE + ": " + IdentityMgtConstants.
                    ErrorHandling.ERROR_LOADING_EMAIL_TEMP + " " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.EXTERNAL_CODE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + ": " + IdentityMgtConstants.
                    ErrorHandling.EXTERNAL_CODE + " " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.CREATING_NOTIFICATION_ERROR)) {
            vBean = handleError(VerificationBean.ERROR_CODE_RECOVERY_NOTIFICATION_FAILURE + ": " + IdentityMgtConstants.
                    ErrorHandling.CREATING_NOTIFICATION_ERROR + " " + userName, e);
        } else if (e.getMessage().contains(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE)) {
            vBean = handleError(VerificationBean.ERROR_CODE_LOADING_DATA_FAILURE + " Error" +
                    " loading data for user : " + userName, e);
        } else if (e.getMessage().contains(IdentityMgtConstants.ErrorHandling.USER_ACCOUNT)) {
            vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " No user account found for user", e);
        }
        return vBean;
    } else {
        vBean = handleError(VerificationBean.ERROR_CODE_INVALID_CODE + " No user account found for user", e);
        return vBean;
    }
}
 
Example 8
Source File: SAMLInboundFunctions.java    From identity-api-server with Apache License 2.0 3 votes vote down vote up
private static APIError buildBadRequestError(String message, IdentityException ex) {

        String errorCode = ex.getErrorCode();
        String errorDescription = ex.getMessage();

        return Utils.buildClientError(errorCode, message, errorDescription);
    }
 
Example 9
Source File: SAMLInboundFunctions.java    From identity-api-server with Apache License 2.0 3 votes vote down vote up
private static APIError buildServerError(String message, IdentityException e) {

        String errorCode = e.getErrorCode();
        String errorDescription = e.getMessage();

        return Utils.buildServerError(errorCode, message, errorDescription, e);
    }