use of org.wso2.carbon.identity.api.server.userstore.v1.model.ClaimAttributeMapping in project identity-api-server by wso2.
the class ServerUserStoreService method getClaimAttributeMappings.
/**
* To list the claim attribute mappings for specific user store domain.
*
* @param tenantDomain the tenant domain.
* @param userstoreDomainName the user store domain name.
* @return List<ClaimAttributeMapping>.
*/
private List<ClaimAttributeMapping> getClaimAttributeMappings(String tenantDomain, String userstoreDomainName) {
ClaimMetadataManagementService claimMetadataManagementService = UserStoreConfigServiceHolder.getInstance().getClaimMetadataManagementService();
List<ClaimAttributeMapping> claimAttributeMappingList = new ArrayList<>();
try {
List<LocalClaim> localClaimList = claimMetadataManagementService.getLocalClaims(tenantDomain);
for (LocalClaim localClaim : localClaimList) {
if (localClaim.getMappedAttribute(userstoreDomainName) != null) {
ClaimAttributeMapping mapping = new ClaimAttributeMapping();
mapping.setClaimURI(localClaim.getClaimURI());
mapping.setMappedAttribute(localClaim.getMappedAttribute(userstoreDomainName));
claimAttributeMappingList.add(mapping);
}
}
return claimAttributeMappingList;
} catch (ClaimMetadataException e) {
throw handleClaimManagementException(e, UserStoreConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_CLAIM_MAPPING);
}
}
Aggregations