/** * Should not allow to have domain prefixed with 'FEDERATED', to avoid conflicting with federated user domain. * @param domain : domain name * @return */ private void validateForFederatedDomain(String domain) throws UserStoreException { if (IdentityUtil.isNotBlank(domain) && domain.toUpperCase().startsWith("FEDERATED")) { throw new UserStoreException("'FEDERATED' is a reserved user domain prefix. " + "Please start the domain name in a different manner."); } }
private Connection getDBConnection() throws SQLException, UserStoreException { Connection dbConnection = IdentityDatabaseUtil.getUserDBConnection(); if (dbConnection == null) { throw new UserStoreException("Could not create a database connection to User database"); } dbConnection.setAutoCommit(false); dbConnection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); return dbConnection; } }
private Claim[] getClaimsToEnterData(UserRealm realm) throws UserStoreException { try { return getAllSupportedClaims(realm, UserCoreConstants.DEFAULT_CARBON_DIALECT); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException(e); } }
/** * Should not allow to have domain prefixed with 'FEDERATED', to avoid conflicting with federated user domain. * @param domain : domain name * @return */ private void validateForFederatedDomain(String domain) throws UserStoreException { if (IdentityUtil.isNotBlank(domain) && domain.toUpperCase().startsWith("FEDERATED")) { throw new UserStoreException("'FEDERATED' is a reserved user domain prefix. " + "Please start the domain name in a different manner."); } }
private Claim[] getClaimsToEnterData(UserRealm realm) throws UserStoreException { try { return getAllSupportedClaims(realm, UserCoreConstants.DEFAULT_CARBON_DIALECT); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException(e); } }
/** * @param value * @return * @throws UserStoreException */ public static String doHash(String value) throws UserStoreException { try { String digsestFunction = "SHA-256"; MessageDigest dgst = MessageDigest.getInstance(digsestFunction); byte[] byteValue = dgst.digest(value.getBytes()); return Base64.encode(byteValue); } catch (NoSuchAlgorithmException e) { log.error(e.getMessage(), e); throw new UserStoreException(e.getMessage(), e); } }
/** * @param value * @return * @throws UserStoreException */ public static String doHash(String value) throws UserStoreException { try { String digsestFunction = "SHA-256"; MessageDigest dgst = MessageDigest.getInstance(digsestFunction); byte[] byteValue = dgst.digest(value.getBytes()); return Base64.encode(byteValue); } catch (NoSuchAlgorithmException e) { log.error(e.getMessage(), e); throw new UserStoreException(e.getMessage(), e); } }
/** * @param value * @return * @throws UserStoreException */ public static String doHash(String value) throws UserStoreException { try { String digsestFunction = "SHA-256"; MessageDigest dgst = MessageDigest.getInstance(digsestFunction); byte[] byteValue = dgst.digest(value.getBytes()); return Base64.encode(byteValue); } catch (NoSuchAlgorithmException e) { log.error(e.getMessage(), e); throw new UserStoreException(e.getMessage(), e); } }
@Override public void onUserStoreNamePreUpdate(int tenantId, String currentUserStoreName, String newUserStoreName) throws UserStoreException { try { UserProfileMgtDAO.getInstance().updateDomainNameOfAssociations(tenantId, currentUserStoreName, newUserStoreName); } catch (UserProfileException e) { throw new UserStoreException(String.format("Error occurred while updating user domain of associated " + "ids with domain '%s'", currentUserStoreName), e); } }
@Override public void onUserStoreNamePreUpdate(int tenantId, String currentUserStoreName, String newUserStoreName) throws UserStoreException { try { UserProfileMgtDAO.getInstance().updateDomainNameOfAssociations(tenantId, currentUserStoreName, newUserStoreName); } catch (UserProfileException e) { throw new UserStoreException(String.format("Error occurred while updating user domain of associated " + "ids with domain '%s'", currentUserStoreName), e); } }
@Override public void onUserStorePreDelete(int tenantId, String userStoreName) throws UserStoreException { try { UserProfileMgtDAO.getInstance().deleteAssociationsFromDomain(tenantId, userStoreName); } catch (UserProfileException e) { throw new UserStoreException(String.format("Error occurred while deleting associated ids with " + "domain '%s'", userStoreName), e); } } }
@Override public void onUserStorePreDelete(int tenantId, String userStoreName) throws UserStoreException { try { UserProfileMgtDAO.getInstance().deleteAssociationsFromDomain(tenantId, userStoreName); } catch (UserProfileException e) { throw new UserStoreException(String.format("Error occurred while deleting associated ids with " + "domain '%s'", userStoreName), e); } } }
@Override @Deprecated public ClaimMapping[] getAllClaimMappings() throws UserStoreException { try { List<LocalClaim> localClaims = localClaimDAO.getLocalClaims(this.tenantId); List<ClaimMapping> claimMappings = new ArrayList<>(); for (LocalClaim localClaim : localClaims) { ClaimMapping claimMapping = ClaimMetadataUtils.convertLocalClaimToClaimMapping(localClaim); claimMappings.add(claimMapping); } return claimMappings.toArray(new ClaimMapping[0]); } catch (ClaimMetadataException e) { throw new UserStoreException(e.getMessage(), e); } }
@Override public void onUserStoreNamePreUpdate(int tenantId, String currentUserStoreName, String newUserStoreName) throws UserStoreException { try { UserAccountAssociationDAO.getInstance().updateDomainNameOfAssociations(tenantId, currentUserStoreName, newUserStoreName); } catch (UserAccountAssociationException e) { throw new UserStoreException(String.format(UserAccountAssociationConstants.ErrorMessages .ERROR_WHILE_UPDATING_ASSOC_DOMAIN.getDescription(), currentUserStoreName), e); } }
@Override public void onUserStorePreDelete(int tenantId, String userStoreName) throws UserStoreException { try { UserAccountAssociationDAO.getInstance().deleteAssociationsFromDomain(tenantId, userStoreName); } catch (UserAccountAssociationException e) { throw new UserStoreException(String.format(UserAccountAssociationConstants.ErrorMessages .ERROR_WHILE_DELETING_ASSOC_FROM_DOMAIN.getDescription(), userStoreName), e); } } }
private String[] getAvailableProfileConfiguration( ProfileConfigurationManager profileAdmin) throws UserStoreException { ProfileConfiguration[] configurations; String[] profileNames = new String[0]; try { configurations = (ProfileConfiguration[]) profileAdmin.getAllProfiles(); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException(e); } if (configurations != null) { profileNames = new String[configurations.length]; for (int i = 0; i < configurations.length; i++) { profileNames[i] = configurations[i].getProfileName(); } } return profileNames; }
@Override @Deprecated public ClaimMapping[] getAllSupportClaimMappingsByDefault() throws UserStoreException { try { List<LocalClaim> localClaims = localClaimDAO.getLocalClaims(this.tenantId); List<ClaimMapping> claimMappings = new ArrayList<>(); for (LocalClaim localClaim : localClaims) { ClaimMapping claimMapping = ClaimMetadataUtils.convertLocalClaimToClaimMapping(localClaim, this .tenantId); if (claimMapping.getClaim().isSupportedByDefault()) { claimMappings.add(claimMapping); } } return claimMappings.toArray(new ClaimMapping[0]); } catch (ClaimMetadataException e) { throw new UserStoreException(e.getMessage(), e); } }
@Override @Deprecated public ClaimMapping[] getAllRequiredClaimMappings() throws UserStoreException { try { List<LocalClaim> localClaims = localClaimDAO.getLocalClaims(this.tenantId); List<ClaimMapping> claimMappings = new ArrayList<>(); for (LocalClaim localClaim : localClaims) { ClaimMapping claimMapping = ClaimMetadataUtils.convertLocalClaimToClaimMapping(localClaim); if (claimMapping.getClaim().isRequired()) { claimMappings.add(claimMapping); } } return claimMappings.toArray(new ClaimMapping[0]); } catch (ClaimMetadataException e) { throw new UserStoreException(e.getMessage(), e); } } }
@Override @Deprecated public ClaimMapping[] getAllSupportClaimMappingsByDefault() throws UserStoreException { try { List<LocalClaim> localClaims = localClaimDAO.getLocalClaims(this.tenantId); List<ClaimMapping> claimMappings = new ArrayList<>(); for (LocalClaim localClaim : localClaims) { ClaimMapping claimMapping = ClaimMetadataUtils.convertLocalClaimToClaimMapping(localClaim, this .tenantId); if (claimMapping.getClaim().isSupportedByDefault()) { claimMappings.add(claimMapping); } } return claimMappings.toArray(new ClaimMapping[0]); } catch (ClaimMetadataException e) { throw new UserStoreException(e.getMessage(), e); } }
@Override @Deprecated public ClaimMapping[] getAllSupportClaimMappingsByDefault() throws UserStoreException { try { List<LocalClaim> localClaims = localClaimDAO.getLocalClaims(this.tenantId); List<ClaimMapping> claimMappings = new ArrayList<>(); for (LocalClaim localClaim : localClaims) { ClaimMapping claimMapping = ClaimMetadataUtils.convertLocalClaimToClaimMapping(localClaim); if (claimMapping.getClaim().isSupportedByDefault()) { claimMappings.add(claimMapping); } } return claimMappings.toArray(new ClaimMapping[0]); } catch (ClaimMetadataException e) { throw new UserStoreException(e.getMessage(), e); } }