[keycloak-user] User Attributes not added in token
Sandeep Rai
raisandeepkmr at gmail.com
Tue May 22 20:52:04 EDT 2018
Hi Community,
I'm new to keycloak. And trying to federate login via external database.
While federating username and password validation trough JPA I'm trying to
add user attribute to the token.
To achieve that all I'm doing is adding the attribute in getAtrributes
method. As I'm expecting it then adds to the token. But after successful
validation the token I get does not have the 'phone' attribute
Is there something I'm missing ?
Do I have to add this attribute any other way ?
File:
public class UserAdapter extends AbstractUserAdapterFederatedStorage
@Override
public Map<String, List<String>> getAttributes() {
Map<String, List<String>> attrs = super.getAttributes();
MultivaluedHashMap<String, String> all = new MultivaluedHashMap<>();
all.putAll(attrs);
all.add("phone", userEntity.getMOBILE_NO());
return all;
}
Kind Regards
More information about the keycloak-user
mailing list