Hi,
Sorry I fail to provide enough info in the previous question, so here is
the detail.
Say I have implemented a new social login privider:
public class WechatWorkIdentityProvider extends
AbstractOAuth2IdentityProvider<WechatWorkProviderConfig> implements
SocialIdentityProvider<WechatWorkProviderConfig>
There are several attributes from this IdP need to be added to keycloak. So
I added them in `BrokeredIdentityContext`, details:
```
@Override
protected BrokeredIdentityContext
extractIdentityFromProfile(EventBuilder event, JsonNode profile) {
BrokeredIdentityContext identity = new BrokeredIdentityContext(
(getJsonProperty(profile, "userid")));
identity.setUsername(getJsonProperty(profile,
"userid").toLowerCase());
identity.setBrokerUserId(getJsonProperty(profile,
"userid").toLowerCase());
identity.setModelUsername(getJsonProperty(profile,
"userid").toLowerCase());
identity.setFirstName(getJsonProperty(profile,
"email").split("(a)")[0].toLowerCase());
identity.setLastName(getJsonProperty(profile, "name"));
identity.setEmail(getJsonProperty(profile, "email").toLowerCase());
identity.setUserAttribute(PROFILE_MOBILE, getJsonProperty(profile,
"mobile"));
identity.setUserAttribute(PROFILE_GENDER, getJsonProperty(profile,
"gender"));
identity.setUserAttribute(PROFILE_STATUS, getJsonProperty(profile,
"status"));
identity.setUserAttribute(PROFILE_ENABLE, getJsonProperty(profile,
"enable"));
identity.setIdpConfig(getConfig());
identity.setIdp(this);
AbstractJsonUserAttributeMapper.storeUserProfileForMapper(identity,
profile, getConfig().getAlias());
return identity;
}
```
New users will set and map mobile/gender... correctly, but old users
already logged in with IdP will not receive custom attributes.
My question is how can I make user attributes update everytime user login
with the social IdP not matter it's old or new user?
Is there another method that I need to override, or another API to call, or
I have to modify keycloak source code?
Thanks!
Victor Z.