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;
}
}
}
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);
}
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);
}
}
Aggregations