use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project carbon-identity-framework by wso2.
the class ClaimAdminClient method getAllClaimMappingsByDialectWithRole.
/**
* We need to treat http://wso2.org/claims/role claim differently.
* Should not be set to supporrtedByDefaut to true.
*
* @param dialect
* @return
* @throws AxisFault
*/
public ClaimDialectDTO getAllClaimMappingsByDialectWithRole(String dialect) throws AxisFault {
try {
ClaimDialectDTO claims = stub.getClaimMappingByDialect(dialect);
ClaimMappingDTO[] oldClaims = claims.getClaimMappings();
ClaimMappingDTO[] newClaims = new ClaimMappingDTO[claims.getClaimMappings().length + 1];
int i = 0;
for (; i < oldClaims.length; i++) {
newClaims[i] = oldClaims[i];
}
ClaimMappingDTO mapping = new ClaimMappingDTO();
ClaimDTO role = new ClaimDTO();
role.setClaimUri("http://wso2.org/claims/role");
mapping.setClaim(role);
newClaims[i] = mapping;
// If role group separation is enabled, we need to send the roles claim also as UI might need that.
ClaimMappingDTO rolesMapping = new ClaimMappingDTO();
ClaimDTO roles = new ClaimDTO();
roles.setClaimUri("http://wso2.org/claims/roles");
rolesMapping.setClaim(roles);
newClaims[i] = rolesMapping;
claims.setClaimMappings(newClaims);
return claims;
} catch (Exception e) {
handleException("Error while reading claim mappings by dialect", e);
}
return null;
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project carbon-identity-framework by wso2.
the class ClaimAdminService method convertClaimDTOToClaim.
private Claim convertClaimDTOToClaim(ClaimDTO claimDTO) {
Claim claim = new Claim();
claim.setSupportedByDefault(claimDTO.isSupportedByDefault());
claim.setValue(claimDTO.getValue());
claim.setClaimUri(claimDTO.getClaimUri());
claim.setDescription(claimDTO.getDescription());
claim.setDialectURI(claimDTO.getDialectURI());
claim.setDisplayOrder(claimDTO.getDisplayOrder());
claim.setDisplayTag(claimDTO.getDisplayTag());
claim.setRegEx(claimDTO.getRegEx());
claim.setRequired(claimDTO.isRequired());
claim.setCheckedAttribute(claimDTO.isCheckedAttribute());
claim.setReadOnly(claimDTO.isReadOnly());
return claim;
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO 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()]);
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project identity-governance by wso2-extensions.
the class Utils method getClaims.
public static Claim[] getClaims(List<ClaimDTO> claimDTOs) {
if (claimDTOs != null && claimDTOs.size() > 0) {
Claim[] claims = new Claim[claimDTOs.size()];
for (int i = 0; i < claimDTOs.size(); i++) {
Claim claim = new Claim();
claim.setClaimUri(claimDTOs.get(i).getUri());
claim.setValue(claimDTOs.get(i).getValue());
claims[i] = claim;
}
return claims;
} else {
return new Claim[0];
}
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project identity-governance by wso2-extensions.
the class UtilsTest method buildClaimDTO.
private List<ClaimDTO> buildClaimDTO() {
ClaimDTO claimDTO = new ClaimDTO();
claimDTO.setValue("testValue");
claimDTO.setUri("testUri");
List<ClaimDTO> claimDTOs = Lists.newArrayList(claimDTO);
return claimDTOs;
}
Aggregations