« 返回到 LDAP with AD

LDAP with AD in Liferay 6.0.5

1. Introduction :

This is an example of a basic LDAP integration in Liferay 6.0.5. In the example we import users/groups into Liferay via LDAP and vice versa.

2. Environment

Windows Server 2003, Active Directory
Liferay 6.0.5


3. LDAP & AD

LDAP

LDAP (Lightweight Directory Access Protocol) is a directory publishing service and specially designed for directory service providers.

Active Directory

AD (Active directory) is a directory service provider, where you can add new user to a directory, remove or modify, specify privilages, assign policy etc. Its just like a phone directory where every person have a unique contact number. Everything in AD(Active Directory) are considered as Objects and every object is given a Unique ID.

LDAP vs AD

AD is a directory services database, and LDAP is one of the protocols you can use to talk to it.


4 : AD Users

First you need to setup the Active Directory.

In Active Directory you need to define 2 OU(Organizational Unit). One is for storing or categorizing all the users. The second is to Create the groups.

For example:-

a) OU=Users

b) OU=Groups

4.1 Create OU in AD:

Go to DN – right click – NewOrganizational Unit

4.2 Create Users in AD:
Go to OU (mpower) – right click – NewUser

4.3 User’s Attributes:

You can test the users account by login in Active Directory machine with newly created users.

5. LDAP Configuration in Liferay

5.1 : Integration

a. Login as Administrator in liferay portal.

b. Go to Control Panel -> Settings -> Authentication -> LDAP select tab.



c. Check the Enabled box.

d. Id. If the Required box is checked only users in the LDAP server will be able to log into Liferay Portal. For this demonstration leave the box unchecked.

5.2: Server Name

Liferay Portal supports other directory servers in addition to the ones provided. The Apache Directory Server, Microsoft Active Directory Server, and Novell eDirectory comes preconfigured.

Select Server Name : Microsoft Active directory Server

5.3: Connection :

Provide given values and Test LDAP Connection :

Base Provider Url : ldap://172.22.1.26:389

Base DN : ou=Tech,dc=mpowerglobal,dc=com

Principal : mpowerglobal\administrator

credentials : abc123.


mpowerglobal - domain name in AD

Tech - Organizational Unit

172.22.1.26 : IP in AD Machine

389 : Port No.

ldap://172.22.1.26:389: This tells the portal where the LDAP server is located )

5.4: TEST LDAP CONNECTION :

Now test your connection to see if it validates.. You can test the connection by clicking “Test LDAP Connection” button. If it shows successful message, your connection is successful....

5.5: Users :

If you wish to change how users login (Ex. Login with screen name / emailaddress), then change the settings in the Authentication Search Filter field.

5.5.1 Users:

Provide these values :

Authentication Search Filter : (&objectCategory=Person)(mail=@email_address@)

import search filter: (objectClass=User)

( if objectClass is defined as “User” in AD, then we have to give “User” .

[ObjectClass = User, InetOrgPerson,...etc ] )

5.5.2 User Mapping :

Provide these values :

screenName : sn

password: userPassword

EmailAddress : mail

first Name : givenName

LastName : sn

Jobtitle : title

Group : memberOf

5.6 TEST LDAP USERS:

Now you can test the groups by clicking “Test LDAP Users” button. It will show all the Users from Active Directory.

Step 5.7: Import Users to Liferay

if you checked "Import on Startup Enabled", then restart your App Server.

Log back in, go the Control Panel->Users . Your imported Users will be there!

Imported Users :

Step 5.8: Groups

5.8.1 Groups

Provide these values:

importSearchfilter : (objectClass=group)

5.8.2: GroupMapping:

GroupName : cn

Description: description

User: member


5.9: TEST LDAP GROUPS:

Now you can test the groups by clicking “Test LDAP Groups” button. It will show all the Groups under the given OU ( Tech) from Active Directory. Also It will show Members of that groups.


5.10. Import Groups to Liferay User Group

LDAP groups are pulled into Liferay as UserGroups

Follow the “Step 4.9: Import Users to Liferay” which will import groups from AD to Liferay as follows:

6. AD-GROUPS – USERS Structure

( Create the following groups in AD, test1, ss & sss under the “Tech” [OU] and assign some users to that groups)


7. Export Users to AD


We can exports all the users from liferay to AD by providing these values.

Users DN = ou=Tech,dc=mpowerglobal,dc=com

User Default Object Classes = top,person,User,organizationPerson

Groups DN = ou=groups,dc=mpowerglobal,dc=com

Group Default Object Classes= top, group

( Note : if you give object name “User” in User Default Object Classes ,

In AD, object type will be “User” )

7.1: Add Liferay users: Go to Control Panel – Users – Add users

After setting the above value in control panel, if you create users in Liferay, it will be exported to AD.

 

7.2: Verify AD Users from Liferay:

All the Users from Liferay will be populated in AD as follows:

( Selected Users from below screen has been exported from Liferay)

 

8. Login into Liferay with Imported User

We need to uncheck this below option in AD : “User must change password at next logon”

If this checkbox is unchecked , then you can login with that particular user into Liferay.

If not, we need to login again in AD and change password, then Import to Liferay.


9. Troubleshooting

1. If User is not imported AD to Liferay,

a. Restart AD Server / Liferay

b. Make sure all the attributes are given while creating User in AD.

For ex, (Screen Name, Password, Email Address, First Name, and Last Name)

 


2. If imported user is not able to login into Liferay, uncheck the below option in AD while

creating user:

“User must change password at next logon”

 


3. If Group is not imported from AD to Liferay,

a. Make sure all the attributes are given while creating Group in AD,

For ex, (name,description)

b. If No member is assigned to Group in AD, That group will not import to Liferay.

 


4. Password Policy

Portal can be configured to use LDAP password policies. To configure the Portal to use LDAP's password policy, go to

· > Control Panel

· > "Settings" tab

· > "Authentication" tab

· > "LDAP" tab

· > and under the "Password Policy" section, click the "Use LDAP Password Policy" checkbox on (at the bottom)

If that has been done correctly, when you try and view the liferay Control Panel - Password Policy, you will get a message saying that “You are using LDAP's password policy. Please change your LDAP password policy settings if you wish to use a local password policy”.

 

0 附件
109554 查看
平均 (0 票)
满分为 5,平均得分为 0.0。
评论
讨论主题回复 作者 日期
Esto esta muy bien explicado Fernando Maza 2011年1月25日 下午5:42
nice tutorial. and I have an issue when... Santhosh Kumar Poornachandra 2011年2月15日 上午9:21
I have never been able to use the email address... Tom Thomas 2011年3月1日 下午1:17
i could import the users but they cant login.... Joel Ferreira 2011年7月14日 上午2:51
Solved, thanks Tom Thomas! Joel Ferreira 2011年7月19日 上午3:40
Hi Joel, I am facing the same problem. Can u... Deawn Md Alimozzaman 2011年11月16日 上午1:14
Hi Paradise Lost, Sorry for the so long delay,... Joel Ferreira 2013年6月12日 下午12:54
I have a question, we synchronized the AD users... Rogelio Meza 2012年2月8日 上午7:36
Hi all, How I configuration auto add user in... Hau Van 2012年5月21日 下午11:55
I had the issue and I see no one answers how to... Aaron Weikle 2012年10月31日 下午12:37
I installed Apache DS and integrated with... Pradip A Bhatt 2013年6月11日 上午5:24
Has anybody tried this on Windows server 2008? John Peterson 2013年6月29日 下午10:27
Yes this works on Windows Server 2008 Josef Krzywon 2013年10月3日 上午9:39
Accordingly to the X.500 User schema definition... Ricardo Lorenzo 2014年1月8日 上午12:49
I am working with Liferay 6.0.5 . I am trying... ahmed almolla 2015年1月30日 上午8:03

Esto esta muy bien explicado
在 11-1-25 下午5:42 发帖。
nice tutorial. and I have an issue when importing user from LDAP. User in LDAP does not have mail attribute, when user logins in liferay forwards to a page to manually enter email address. but this step should be skipped as per our requirements. can somebody help?
在 11-2-15 上午9:21 发帖。
I have never been able to use the email address from LDAP to login. That is using the settings in this wiki article and variations on it - even though I get a valid list of users when I press the "test LDAP users" button.
I've only been able to use the screen name for logins with the authentication search filter set to (sAMAccountName=@screen_name@)
在 11-3-1 下午1:17 发帖。
i could import the users but they cant login. What could be the reason? Thanks.
在 11-7-14 上午2:51 发帖。
Solved, thanks Tom Thomas!
在 11-7-19 上午3:40 发帖以回复 Joel Ferreira
Hi Joel,
I am facing the same problem. Can u pls tell me how did you fix it?
在 11-11-16 上午1:14 发帖以回复 Joel Ferreira
I have a question, we synchronized the AD users and reboot the server, and can not enter the portal, or with AD users or the administrator who creates the principle of the installation, I can do?
在 12-2-8 上午7:36 发帖。
Hi all,
How I configuration auto add user in Liferay when one user added in AD. I mean when I add new user in AD, it auto add user in Liferay
在 12-5-21 下午11:55 发帖。
I had the issue and I see no one answers how to fix it....well for most of us who are integrating with AD you have a User Logon ID that AD uses for authentication. Here is how you fix it:

Step one set How to authenticate to "By Screen Name"
Step two set Authentication Search Filter to "(sAMAccountName=@screen_name@)"
Step three set ScreenName to "sAMAccountName"

Save your LDAP configuration and you will be able to authenticate against AD

Cheers,
Aaron
在 12-10-31 下午12:37 发帖以回复 Hau Van
I installed Apache DS and integrated with Liferay. I am using Liferay 6.2.0 m2 CE version., But now If I delete user from LDAP then also Liferay provides login facility. It should be deleted from Liferay table also. As well as at the time of creation of new user in liferay, it must be added into LDAP automatically.

please reply me.
在 13-6-11 上午5:24 发帖。
Hi Paradise Lost,

Sorry for the so long delay, only have came here now because an email from last reply. If i remember correctly i followed the Tom Thomas suggestion. Anyway i hope you have already this solved eheheh

Regards,
在 13-6-12 下午12:54 发帖以回复 Paradise Lost
Has anybody tried this on Windows server 2008?
在 13-6-29 下午10:27 发帖。
Yes this works on Windows Server 2008
在 13-10-3 上午9:39 发帖以回复 John Peterson
Accordingly to the X.500 User schema definition for LDAPv3 (http://www.ietf.org/rfc/rfc2256.txt), the attribute "sn" always refer to the surname, and should not be mapped to the screenname. The proper attribute on AD should be sAMAccountName and "uid" in the case of other directories.
在 14-1-8 上午12:49 发帖。
I am working with Liferay 6.0.5 . I am trying to set the active directory settings on Liferay.
when I set the configurations and click on save the settings and reopen it again to edit i find that user mapping data is empty , How to fix this ?
note : when i click on test users its succeeds
and when i try to authenticat active directory user I get
"ERROR [LDAPAuth:318] Problem accessing LDAP server
3com.liferay.portal.UserEmailAddressException: Email address cannot be null for"
what is the cause of this
I have some questions :
1)Can the user change his active directory password from Liferay?
if yes, is there a special configuration for that on both liferay and active directory ?
if no,what is the alternative ?

2) If the user active directory password is going to expire will he get a notification on liferay before it expires ?

3) If the user entered a wrong password more than say 3 times and the active directory policy is lock the user account , is this going to affect Liferay user and how?
在 15-1-30 上午8:03 发帖。