Search in sources :

Example 26 with ClaimDTO

use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project product-is by wso2.

the class AbstractUUIDUMTestCase method testDeleteUserClaimValueWithID.

public void testDeleteUserClaimValueWithID() throws Exception {
    String claimUri = "http://wso2.org/claims/lastname";
    String claimValue = "lastname";
    userMgtClient.setUserClaimValueWithID(userId, claimUri, claimValue, defaultProfile);
    userMgtClient.deleteUserClaimValueWithID(userId, claimUri, defaultProfile);
    ClaimDTO[] claimDTOs = userMgtClient.getUserClaimValuesWithID(userId, defaultProfile);
    for (ClaimDTO claimDTO : claimDTOs) {
        if (claimUri.equals(claimDTO.getClaimUri())) {
            Assert.assertNotEquals(claimValue, claimDTO.getValue());
            break;
        }
    }
}
Also used : ClaimDTO(org.wso2.carbon.identity.test.integration.service.stub.ClaimDTO)

Example 27 with ClaimDTO

use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project product-is by wso2.

the class ClaimManagementServiceClient method addNewClaimMapping.

public void addNewClaimMapping(String dialectURI, String claimUri, String description, String mappedAttribute) throws ClaimManagementServiceClaimManagementException, RemoteException {
    ClaimMappingDTO claimMappingDTO = new ClaimMappingDTO();
    ClaimDTO claimDTO = new ClaimDTO();
    claimDTO.setDialectURI(dialectURI);
    claimDTO.setClaimUri(claimUri);
    claimDTO.setDescription(description);
    claimMappingDTO.setClaim(claimDTO);
    claimMappingDTO.setMappedAttribute(mappedAttribute);
    claimManagementServiceStub.addNewClaimMapping(claimMappingDTO);
}
Also used : ClaimMappingDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimMappingDTO) ClaimDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimDTO)

Example 28 with ClaimDTO

use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project product-is by wso2.

the class ClaimManagementServiceTestCase method testAddNewCliamDialect.

@Test(alwaysRun = true, description = "Add new claim dialect")
public void testAddNewCliamDialect() {
    ClaimMappingDTO mapping = new ClaimMappingDTO();
    ClaimDTO claim = new ClaimDTO();
    claim.setClaimUri(CLAIM_URI);
    claim.setDisplayTag(DISPLAY_NAME);
    claim.setDescription(DESCRIPTION);
    claim.setDialectURI(DIALECT);
    claim.setRegEx(REGEX);
    claim.setDisplayOrder(DISPLAY_ORDER);
    claim.setRequired(REQUIRED);
    claim.setSupportedByDefault(SUPPORTED);
    claim.setReadOnly(READONLY);
    mapping.setClaim(claim);
    if (ATTRIBUTE != null) {
        String[] attributes = ATTRIBUTE.split(";");
        List<ClaimAttributeDTO> attrList = new ArrayList<ClaimAttributeDTO>();
        for (int i = 0; i < attributes.length; i++) {
            int index = 0;
            if ((index = attributes[i].indexOf("/")) > 1) {
                String domain = attributes[i].substring(0, index);
                String attrName = attributes[i].substring(index + 1);
                if (domain != null) {
                    ClaimAttributeDTO attr = new ClaimAttributeDTO();
                    attr.setAttributeName(attrName);
                    attr.setDomainName(domain);
                    attrList.add(attr);
                }
            } else {
                ClaimAttributeDTO attr = new ClaimAttributeDTO();
                attr.setAttributeName(attributes[i]);
                attr.setDomainName(null);
                attrList.add(attr);
            }
        }
        if (attrList.size() > 0) {
            mapping.setMappedAttributes(attrList.toArray(new ClaimAttributeDTO[attrList.size()]));
        }
    }
    try {
        ClaimDialectDTO dialectDTO = new ClaimDialectDTO();
        dialectDTO.addClaimMappings(mapping);
        dialectDTO.setDialectURI(DIALECT);
        dialectDTO.setUserStore(STORE);
        adminClient.addNewClaimDialect(dialectDTO);
        dialectDTO = adminClient.getClaimMappingByDialect(DIALECT);
        Assert.assertNotNull(dialectDTO, "Error occured while adding claim dialect.");
    } catch (Exception e) {
        Assert.fail("Error while trying to add new claim dialect", e);
    }
}
Also used : ClaimMappingDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimMappingDTO) ClaimDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimDTO) ArrayList(java.util.ArrayList) ClaimAttributeDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimAttributeDTO) ClaimDialectDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimDialectDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Aggregations

ArrayList (java.util.ArrayList)9 ClaimDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimDTO)7 ClaimMappingDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimMappingDTO)7 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)5 Test (org.testng.annotations.Test)4 ClaimDialectDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimDialectDTO)4 Claim (org.wso2.carbon.user.api.Claim)4 HashMap (java.util.HashMap)3 ClaimAttributeDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimAttributeDTO)3 ClaimDTO (org.wso2.carbon.identity.test.integration.service.stub.ClaimDTO)3 ClaimDTO (org.wso2.carbon.identity.user.endpoint.dto.ClaimDTO)3 ClaimDTO (org.wso2.carbon.um.ws.api.stub.ClaimDTO)3 UserIdentityClaimDTO (org.wso2.carbon.identity.mgt.dto.UserIdentityClaimDTO)2 ClaimDTO (org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO)2 ClaimValue (org.wso2.carbon.identity.test.integration.service.stub.ClaimValue)2 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Map (java.util.Map)1 BPackage (org.ballerinalang.jvm.types.BPackage)1 BArray (org.ballerinalang.jvm.values.api.BArray)1