I am creating a keycloak SPI, where I want to get userprofile which contains- user details, user Roles, user Permissions and user claims {oicd claims, resource related claims, roles/permission claims, user attributes, custom attributes}. but I am unable to find out the class through which I can extract claims for the SPI. How to do it. please provide me the class using which I can get all the user claims,
I have followed an approach but it is not working -
public Map<String, String> getClaims(UserModel user) {
Map<String, String> claims = new HashMap<>();
AuthorizationRequest request = new AuthorizationRequest();
Map<String, List<String>> originalClaims = request.getClaims();
log.info("originalClaims: " + originalClaims);
originalClaims.forEach((key, values) -> {
log.info("key: " + key + ", values: " + values);
String value = values.isEmpty() ? null : values.get(0);
claims.put(key, value);
});
log.info("claims: " + claims);
return claims;
}