Forums de discussion
Liferay 6.1.1 CE and LDAP Custom Fields
Ankur Srivastava, modifié il y a 11 années.
Liferay 6.1.1 CE and LDAP Custom Fields
Junior Member Publications: 58 Date d'inscription: 09/11/08 Publications récentes
I was able to successfully import custom attributes / fields from LDAP, over the ones which are imported using the default mapping.
There are quite a few articles to help with this but here I would like to mention some of the roadblocks which I faced so that it can be of help to someone.
Let me first explain what I mean by a custom field.
By default when you configure Liferay to use LDAP if you see portal.properties file there are few mappings defined
for User import:
ldap.user.mappings.0=uuid=uuid\nscreenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
Now if I want to import an additional field like "mobile" from LDAP( which is what I have referred as Custom Field) then there are two primary steps:
1. Create a Custom Field using Liferay Control Panel. Lets call this usermobile. Once created this will be available in User Profile.
2. Create / Update portal-ext.properties file.
In my case this looks like:
ldap.auth.enabled=true
#ldap.auth.required=true
ldap.import.enabled=true
ldap.password.policy.enabled=true
ldap.base.provider.url.0=ldap://localhost:10389
ldap.base.dn.0=dc=example,dc=com
ldap.security.principal.0=uid=admin,ou=system
ldap.security.credentials.0=secret
ldap.auth.search.filter.0=(mail=@email_address@)
ldap.user.mappings.0=uuid=uuid\nscreenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
ldap.user.custom.mappings.0=usermobile=mobile
ldap.group.mappings.0=groupName=cn\ndescription=description\nuser=uniqueMember
ldap.import.user.search.filter.0=(objectClass=inetOrgPerson)
ldap.import.group.search.filter.0=(objectClass=groupOfUniqueNames)
ldap.contact.mappings.0=
ldap.contact.custom.mappings.0=
Also from the Control Panel->Portal Settings->Authentication->LDAP check the enabled box.
Just restart the server and try to login with a user from LDAP.
There are quite a few articles to help with this but here I would like to mention some of the roadblocks which I faced so that it can be of help to someone.
Let me first explain what I mean by a custom field.
By default when you configure Liferay to use LDAP if you see portal.properties file there are few mappings defined
for User import:
ldap.user.mappings.0=uuid=uuid\nscreenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
Now if I want to import an additional field like "mobile" from LDAP( which is what I have referred as Custom Field) then there are two primary steps:
1. Create a Custom Field using Liferay Control Panel. Lets call this usermobile. Once created this will be available in User Profile.
2. Create / Update portal-ext.properties file.
In my case this looks like:
ldap.auth.enabled=true
#ldap.auth.required=true
ldap.import.enabled=true
ldap.password.policy.enabled=true
ldap.base.provider.url.0=ldap://localhost:10389
ldap.base.dn.0=dc=example,dc=com
ldap.security.principal.0=uid=admin,ou=system
ldap.security.credentials.0=secret
ldap.auth.search.filter.0=(mail=@email_address@)
ldap.user.mappings.0=uuid=uuid\nscreenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
ldap.user.custom.mappings.0=usermobile=mobile
ldap.group.mappings.0=groupName=cn\ndescription=description\nuser=uniqueMember
ldap.import.user.search.filter.0=(objectClass=inetOrgPerson)
ldap.import.group.search.filter.0=(objectClass=groupOfUniqueNames)
ldap.contact.mappings.0=
ldap.contact.custom.mappings.0=
Also from the Control Panel->Portal Settings->Authentication->LDAP check the enabled box.
Just restart the server and try to login with a user from LDAP.