use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ClaimDTO in project core-util by WSO2Telco.
the class ClaimUtil method convertToClaims.
public org.wso2.carbon.user.core.claim.Claim[] convertToClaims(ClaimDTO[] claims) {
if (claims == null) {
return new org.wso2.carbon.user.core.claim.Claim[0];
}
org.wso2.carbon.user.core.claim.Claim[] claimz = new org.wso2.carbon.user.core.claim.Claim[claims.length];
int i = 0;
for (ClaimDTO claim : claims) {
claimz[i] = convertToClaim(claim);
i++;
}
return claimz;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ClaimDTO in project carbon-apimgt by wso2.
the class SubscriptionMappingUtil method fromSubscriberClaimsToDTO.
/**
* Convert Subscriber claims information into SubscriberInfoDTO
*
* @param subscriberClaims list of subscriber claims
* @param subscriberName subscriber name
* @return SubscriberInfoDTO
* @throws APIManagementException If an error occurs when getting display name of claim
*/
public static SubscriberInfoDTO fromSubscriberClaimsToDTO(Map<String, String> subscriberClaims, String subscriberName) throws APIManagementException {
SubscriberInfoDTO subscriberInfoDTO = new SubscriberInfoDTO();
subscriberInfoDTO.setName(subscriberName);
List<ClaimDTO> claimDTOList = new ArrayList<>();
for (String key : subscriberClaims.keySet()) {
ClaimDTO claimDTO = new ClaimDTO();
claimDTO.setName(APIUtil.getClaimDisplayName(key, subscriberName));
claimDTO.setURI(key);
claimDTO.setValue(subscriberClaims.get(key));
claimDTOList.add(claimDTO);
}
subscriberInfoDTO.setClaims(claimDTOList);
return subscriberInfoDTO;
}
Aggregations