Pages

Thursday, November 10, 2011

LifeRay Portal with Ldap Server

Share it Please
Since i started working on LifeRay need to explore various ways on handling the User and Groups. I started checking how ldap works with Liferay.In this article we will see how we can configure a Ldap Server with some sample data and configure that with the LifeRay Server. This Article goes in steps,

1. Download Apache DS and Apache Directory Studio.
2. Configure Apache DS.
3. Configure Sample Data into Apache DS using Apache Directory Studio.
4. Integrate Apache Ds and LifeRay.

1. Download Apache DS and Apache Directory Studio.

Download Apache DS and Apache Directory Studio from http://directory.apache.org/.I download apacheds-2.0.0-M3-32bit.bin versions for Red Hat Linux.

I have chosen Apache DS for the following reasons,

     Apache DS is completely written in Java.
     ApacheDS is an embeddable, extendable, standards compliant, modern LDAP server written entirely in Java
     Embeddable means that it is possible to configure start and stop ApacheDS from other Java components, especially application servers, and the server runs within the same VM.
     Extendable means that the modern architecture of the solution provides many extension points. Write your own partitions to store directory data, interceptors to add functionality, etc. by implementing certain interfaces and plugging them in using Spring.
     Entirely written in Java means that the software compiles and runs on a huge number of hardware and software platforms.

2. Configure Apache DS.

Once we have the Apache DS, we will start configuring the Server. Go to the location where you downloaded the bin file, execute the file like,

./apacheds-2.0.0-M3-32bit.bin

Just follow the Steps, It will ask few questions on install location and some other .Just press enter if you are Ok with the default value.

Unpacking the installer...
Extracting the installer...
Where do you want to install Apache DS? [Default: /opt/apacheds-2.0.0-M3]
Where do you want to install Apache DS instances? [Default: /var/lib/apacheds-2.0.0-M3]
What name do you want for the default instance? [Default: default]

Note : make sure you give your own name in this step. Since we use this as a profile which we stop and start.

Where do you want to install the startup script? [Default: /etc/init.d]
Which user do you want to run the server with (if not already existing, the specified user will be created)? [Default: apacheds]

Installing...
id: apacheds: No such user
Warning:  --directory (-d) option is undocumented and no-op.
 Use -rf for deleting non-empty dirs
Warning:  --directory (-d) option is undocumented and no-op.
 Use -rf for deleting non-empty dirs
Done.

ApacheDS has been installed successfully.

Once Apache Ds is installed, we can start the instance using apacheds command available in
/opt/apacheds-2.0.0-M3/bin/

./apacheds start default

In order to stop, ./apacheds stop default
In order to find the Status of the Server, ./apacheds status default

By this we are done configuring the Apache Ds Server.

3. Configure Sample Data into Apache DS using Apache Directory Studio.

I will not be explaining completely on how to configure Data in the Ldap server, but we will configure a sample user and test that using LifeRay.

Download the Apache Directory Studio from http://directory.apache.org/.

Unzip the Apache Directory Studio to any location; click the ApacheDirectoryStudio file in
directory.

Create a connection for the ApacheDS server

Select LDAP -> New Connection 

 
 
























In The next screen , enter the details as ,




























The Bind DN or user is “uid=admin,ou=system”
Bind Password: secret

Once the connection is successful,we see the following left panel ,



























Right click on the “ou=users” and select “New Entry” to create a new User

Select “Create entry from scratch”

In the Next screen, enter the class name “InetOrgperson” in the Available Object Classes.

A group of 4 releated classes will be added inetOrgPerson,organizationPerson,person,top

In the Next Screen, Enter values for RDN as “cn” (in the first box) , Jagadish Manchala (second box)

Select Finish.
 
We will see a Screen like this, if we need to add an attribute, right click and select “New Attribute”

In the Attribute Type “select the Attribute” and click Next -> next -> Finish
Once the attribute is added, double click it to add a value.















The complete details look like this

dn: cn=JagadishManchala,ou=users,ou=system
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
cn: JagadishManchala
sn: Manchala
givenName: JagadishManchala
mail: jagadish@liferay.com
uid: xprk477
userPassword:: e1NTSEF9a2hHcFFPRXRWWlNxY0NKRllQdXlYalIxZURkK1VpazdBRVdoekE9P

4. Integrate Apache Ds and Liferay.

Once the sample data is available in the Apache DS server , we will configure the LifeRay Server with the Apache DS.

Login into the Lifeary Server using test@liferay.com and test.

Go To -> Manage - Control Panel - Portal Settings - Autentication on left
Select Ldap
Check "enabled"

Under that select the Server as “Apache DS”

Enter the requires details and leave the rest as they are .

Once the values are given, 


 

 
























Test the Ldap Connection and Test the users configured in Ldap Server.

If everything goes fine , we will see a screen like this













We can see that user Jagadish that we configured in the Ldap server is available now. Just login using the credentials that we provided.


More Articles To Come , Happy Coding.....




No comments :

Post a Comment