Search in sources :

Example 1 with ClaimDTO

use of org.wso2.carbon.um.ws.api.stub.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;
}
Also used : ClaimDTO(org.wso2.carbon.um.ws.api.stub.ClaimDTO)

Example 2 with ClaimDTO

use of org.wso2.carbon.um.ws.api.stub.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;
}
Also used : ClaimDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ClaimDTO) ArrayList(java.util.ArrayList) SubscriberInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.SubscriberInfoDTO)

Aggregations

ArrayList (java.util.ArrayList)1 ClaimDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ClaimDTO)1 SubscriberInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.SubscriberInfoDTO)1 ClaimDTO (org.wso2.carbon.um.ws.api.stub.ClaimDTO)1