Search in sources :

Example 1 with IdentityClaimManager

use of org.wso2.carbon.identity.core.IdentityClaimManager in project carbon-identity-framework by wso2.

the class UserRegistrationService method readUserFieldsForUserRegistration.

public UserFieldDTO[] readUserFieldsForUserRegistration(String dialect) throws IdentityException {
    IdentityClaimManager claimManager = null;
    Claim[] claims = null;
    List<UserFieldDTO> claimList = null;
    UserRealm realm = null;
    claimManager = IdentityClaimManager.getInstance();
    realm = IdentityTenantUtil.getRealm(null, null);
    claims = claimManager.getAllSupportedClaims(dialect, realm);
    if (claims == null || claims.length == 0) {
        return new UserFieldDTO[0];
    }
    claimList = new ArrayList<UserFieldDTO>();
    for (Claim claim : claims) {
        if (claim.getDisplayTag() != null && !IdentityConstants.PPID_DISPLAY_VALUE.equals(claim.getDisplayTag())) {
            if (UserCoreConstants.ClaimTypeURIs.ACCOUNT_STATUS.equals(claim.getClaimUri())) {
                continue;
            }
            if (!claim.isReadOnly()) {
                claimList.add(getUserFieldDTO(claim.getClaimUri(), claim.getDisplayTag(), claim.isRequired(), claim.getDisplayOrder(), claim.getRegEx(), claim.isSupportedByDefault()));
            }
        }
    }
    return claimList.toArray(new UserFieldDTO[claimList.size()]);
}
Also used : UserRealm(org.wso2.carbon.user.core.UserRealm) UserFieldDTO(org.wso2.carbon.identity.user.registration.dto.UserFieldDTO) IdentityClaimManager(org.wso2.carbon.identity.core.IdentityClaimManager) Claim(org.wso2.carbon.user.core.claim.Claim)

Example 2 with IdentityClaimManager

use of org.wso2.carbon.identity.core.IdentityClaimManager in project identity-governance by wso2-extensions.

the class NotificationUsernameRecoveryManager method getUserIdentitySupportedClaims.

/**
 * This returns the user supported claims.
 *
 * @param dialect
 * @return
 * @throws IdentityRecoveryException
 */
public String[] getUserIdentitySupportedClaims(String dialect, String tenantDomain) throws IdentityException {
    IdentityClaimManager claimManager;
    Claim[] claims;
    claimManager = IdentityClaimManager.getInstance();
    UserRealm realm = IdentityTenantUtil.getRealm(null, null);
    claims = claimManager.getAllSupportedClaims(dialect, realm);
    if (claims == null || claims.length == 0) {
        log.warn("Could not find any matching claims for requested dialect : " + dialect);
        return new String[0];
    }
    List<String> claimList = new ArrayList<>();
    for (int i = 0; i < claims.length; i++) {
        if (claims[i].getDisplayTag() != null && !IdentityConstants.PPID_DISPLAY_VALUE.equals(claims[i].getDisplayTag())) {
            if (UserCoreConstants.ClaimTypeURIs.ACCOUNT_STATUS.equals(claims[i].getClaimUri())) {
                continue;
            }
            if (claims[i].isSupportedByDefault() && (!claims[i].isReadOnly())) {
                claimList.add(claims[i].getClaimUri());
            }
        }
    }
    return claimList.toArray(new String[claimList.size()]);
}
Also used : UserRealm(org.wso2.carbon.user.core.UserRealm) ArrayList(java.util.ArrayList) IdentityClaimManager(org.wso2.carbon.identity.core.IdentityClaimManager) Claim(org.wso2.carbon.user.core.claim.Claim) UserClaim(org.wso2.carbon.identity.recovery.model.UserClaim)

Example 3 with IdentityClaimManager

use of org.wso2.carbon.identity.core.IdentityClaimManager in project identity-governance by wso2-extensions.

the class NotificationUsernameRecoveryManager method getIdentitySupportedClaims.

/**
 * This returns the user supported claims info.
 *
 * @param dialect
 * @return
 * @throws IdentityRecoveryException
 */
public Claim[] getIdentitySupportedClaims(String dialect, String tenantDomain) throws IdentityException {
    IdentityClaimManager claimManager;
    Claim[] claims;
    claimManager = IdentityClaimManager.getInstance();
    UserRealm realm = IdentityTenantUtil.getRealm(tenantDomain, null);
    claims = claimManager.getAllSupportedClaims(dialect, realm);
    if (claims == null || claims.length == 0) {
        log.warn("Could not find any matching claims for requested dialect : " + dialect);
        return new Claim[0];
    }
    return claims;
}
Also used : UserRealm(org.wso2.carbon.user.core.UserRealm) IdentityClaimManager(org.wso2.carbon.identity.core.IdentityClaimManager) Claim(org.wso2.carbon.user.core.claim.Claim) UserClaim(org.wso2.carbon.identity.recovery.model.UserClaim)

Example 4 with IdentityClaimManager

use of org.wso2.carbon.identity.core.IdentityClaimManager in project carbon-identity-framework by wso2.

the class UserInformationRecoveryService method getUserIdentitySupportedClaims.

/**
 * This returns the user supported claims.
 *
 * @param dialect
 * @return
 * @throws IdentityException
 */
public UserIdentityClaimDTO[] getUserIdentitySupportedClaims(String dialect) throws IdentityException {
    IdentityClaimManager claimManager = null;
    Claim[] claims = null;
    UserRealm realm = null;
    claimManager = IdentityClaimManager.getInstance();
    realm = IdentityTenantUtil.getRealm(null, null);
    claims = claimManager.getAllSupportedClaims(dialect, realm);
    if (claims == null || claims.length == 0) {
        log.warn("Could not find any matching claims for requested dialect : " + dialect);
        return new UserIdentityClaimDTO[0];
    }
    List<UserIdentityClaimDTO> claimList = new ArrayList<UserIdentityClaimDTO>();
    for (int i = 0; i < claims.length; i++) {
        if (claims[i].getDisplayTag() != null && !IdentityConstants.PPID_DISPLAY_VALUE.equals(claims[i].getDisplayTag())) {
            if (UserCoreConstants.ClaimTypeURIs.ACCOUNT_STATUS.equals(claims[i].getClaimUri())) {
                continue;
            }
            if (claims[i].isSupportedByDefault() && (!claims[i].isReadOnly())) {
                UserIdentityClaimDTO claimDto = new UserIdentityClaimDTO();
                claimDto.setClaimUri(claims[i].getClaimUri());
                claimDto.setClaimValue(claims[i].getValue());
                claimDto.setRequired(claims[i].isRequired());
                claimDto.setDisplayName(claims[i].getDisplayTag());
                claimList.add(claimDto);
            }
        }
    }
    return claimList.toArray(new UserIdentityClaimDTO[claimList.size()]);
}
Also used : UserRealm(org.wso2.carbon.user.core.UserRealm) ArrayList(java.util.ArrayList) IdentityClaimManager(org.wso2.carbon.identity.core.IdentityClaimManager) UserIdentityClaimDTO(org.wso2.carbon.identity.mgt.dto.UserIdentityClaimDTO) Claim(org.wso2.carbon.user.core.claim.Claim)

Aggregations

IdentityClaimManager (org.wso2.carbon.identity.core.IdentityClaimManager)4 UserRealm (org.wso2.carbon.user.core.UserRealm)4 Claim (org.wso2.carbon.user.core.claim.Claim)4 ArrayList (java.util.ArrayList)2 UserClaim (org.wso2.carbon.identity.recovery.model.UserClaim)2 UserIdentityClaimDTO (org.wso2.carbon.identity.mgt.dto.UserIdentityClaimDTO)1 UserFieldDTO (org.wso2.carbon.identity.user.registration.dto.UserFieldDTO)1