use of org.keycloak.representations.AddressClaimSet in project keycloak by keycloak.
the class AddressMapper method setClaim.
@Override
protected void setClaim(IDToken token, ProtocolMapperModel mappingModel, UserSessionModel userSession) {
UserModel user = userSession.getUser();
AddressClaimSet addressSet = new AddressClaimSet();
addressSet.setStreetAddress(getUserModelAttributeValue(user, mappingModel, STREET));
addressSet.setLocality(getUserModelAttributeValue(user, mappingModel, AddressClaimSet.LOCALITY));
addressSet.setRegion(getUserModelAttributeValue(user, mappingModel, AddressClaimSet.REGION));
addressSet.setPostalCode(getUserModelAttributeValue(user, mappingModel, AddressClaimSet.POSTAL_CODE));
addressSet.setCountry(getUserModelAttributeValue(user, mappingModel, AddressClaimSet.COUNTRY));
addressSet.setFormattedAddress(getUserModelAttributeValue(user, mappingModel, AddressClaimSet.FORMATTED));
token.getOtherClaims().put("address", addressSet);
}
use of org.keycloak.representations.AddressClaimSet in project keycloak by keycloak.
the class OIDCScopeTest method assertAddress.
private void assertAddress(IDToken idToken, boolean claimsIn) {
AddressClaimSet address = idToken.getAddress();
if (claimsIn) {
Assert.assertNotNull(address);
Assert.assertEquals("Elm 5", address.getStreetAddress());
} else {
Assert.assertNull(address);
}
}
Aggregations