mirror of
https://github.com/bmlong137/alfresco-keycloak.git
synced 2025-05-12 21:24:43 +00:00
Map middle name from default OIDC profile
This commit is contained in:
parent
ae9b742dd7
commit
28c7ddb87f
@ -43,6 +43,7 @@ keycloak.authentication.userAuthority.default.property.defaultResourceRoleNameMa
|
||||
keycloak.authentication.userToken.default.property.enabled=true
|
||||
keycloak.authentication.userToken.default.property.mapNull=true
|
||||
keycloak.authentication.userToken.default.property.mapGivenName=true
|
||||
keycloak.authentication.userToken.default.property.mapMiddleName=true
|
||||
keycloak.authentication.userToken.default.property.mapFamilyName=true
|
||||
keycloak.authentication.userToken.default.property.mapEmail=true
|
||||
keycloak.authentication.userToken.default.property.mapPhoneNumber=true
|
||||
|
@ -19,6 +19,7 @@ import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.keycloak.representations.AccessToken;
|
||||
import org.keycloak.representations.IDToken;
|
||||
@ -31,12 +32,17 @@ import org.keycloak.representations.IDToken;
|
||||
public class DefaultPersonProcessor implements UserProcessor
|
||||
{
|
||||
|
||||
// missing in ContentModel constants
|
||||
private static final QName PROP_MIDDLE_NAME = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "middleName");
|
||||
|
||||
protected boolean enabled;
|
||||
|
||||
protected boolean mapNull;
|
||||
|
||||
protected boolean mapGivenName;
|
||||
|
||||
protected boolean mapMiddleName;
|
||||
|
||||
protected boolean mapFamilyName;
|
||||
|
||||
protected boolean mapEmail;
|
||||
@ -72,6 +78,15 @@ public class DefaultPersonProcessor implements UserProcessor
|
||||
this.mapGivenName = mapGivenName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mapMiddleName
|
||||
* the mapMiddleName to set
|
||||
*/
|
||||
public void setMapMiddleName(final boolean mapMiddleName)
|
||||
{
|
||||
this.mapMiddleName = mapMiddleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mapFamilyName
|
||||
* the mapFamilyName to set
|
||||
@ -121,6 +136,10 @@ public class DefaultPersonProcessor implements UserProcessor
|
||||
{
|
||||
personNodeProperties.put(ContentModel.PROP_FIRSTNAME, idToken.getGivenName());
|
||||
}
|
||||
if ((this.mapNull || idToken.getMiddleName() != null) && this.mapMiddleName)
|
||||
{
|
||||
personNodeProperties.put(PROP_MIDDLE_NAME, idToken.getMiddleName());
|
||||
}
|
||||
if ((this.mapNull || idToken.getFamilyName() != null) && this.mapFamilyName)
|
||||
{
|
||||
personNodeProperties.put(ContentModel.PROP_LASTNAME, idToken.getFamilyName());
|
||||
|
Loading…
x
Reference in New Issue
Block a user