Pages

Monday, November 28, 2011

Apache http Server (Basics Configurations)

This summary is not available. Please click here to view the post.
Read More

Friday, November 11, 2011

Deploy a Web Application in LifeRay Portal Server


As we are aware that LifeRay portal server is used for deploying Portal applications, But LifeRay allows us to deploy a standard web application (written in servlet, jsp e.t.c) into the LifeRay portal server as a Portlet application.
In This article we will see how we can deploy a web application as a Portlet in LifeRay portal server.
1. Create a sample web application.
2. Copy the application into the LifeRay Portal Server
3. Add the Portlet
4. Basic Issues

1. Create a sample web application

Create a sample web application (For this demo purpose I have created a sample web application which will have a link, when clicked shows a message).

2. Copy the application into the LifeRay Portal Server

Copy the Application into the auto Deploy folder for liferay.When we see the directory structure of the Liferay portal server , we see

Data
Deploy (Auto Deploy Folder For LifeRay Portal Server)
Jboss-5.1.0
License
Readme.html

Copy the web application into the Deploy directory.we can see the messages in the console about the deployment like,

13:05:53,426 INFO  [AutoDeployDir] Processing SampleApp.war
13:05:53,427 INFO  [PortletAutoDeployListener] Deploying package as a web application
13:05:53,428 INFO  [PortletAutoDeployListener] Copying portlets for /usr/liferay-portal-6.0.6/deploy/SampleApp.war
  Expanding: /usr/liferay-portal-6.0.6/deploy/SampleApp.war into /tmp/20111111130553428
  Copying 1 file to /tmp/20111111130553428/WEB-INF/classes
  Copying 1 file to /tmp/20111111130553428/WEB-INF/classes
  Copying 1 file to /tmp/20111111130553428/WEB-INF
  Copying 1 file to /tmp/20111111130553428/WEB-INF
  Copying 1 file to /tmp/20111111130553428/WEB-INF
  Copying 1 file to /tmp/20111111130553428/WEB-INF/jsp/liferay/wai
  Copying 20 files to /usr/liferay-portal-6.0.6/jboss-5.1.0/server/default/deploy/SampleApp.war
  Copying 1 file to /usr/liferay-portal-6.0.6/jboss-5.1.0/server/default/deploy/SampleApp.war
  Deleting directory /tmp/20111111130553428
13:05:53,566 INFO  [PortletAutoDeployListener] Portlets for /usr/liferay-portal-6.0.6/deploy/SampleApp.war copied successfully. Deployment will start in a few seconds.
13:05:58,194 INFO  [TomcatDeployment] deploy, ctxPath=/SampleApp
13:05:58,347 INFO  [PortletHotDeployListener] Registering portlets for SampleApp
13:05:58,468 INFO  [PortletHotDeployListener] 1 portlet for SampleApp is available for use

Once the Deployment is done,we need to wait for a few minutes until the portlet is auto deployed.

3. Add the Portlet

Create a Page like ,
Select Page from Add Toolbar, Enter the Page Name. The new page will be added.
Click that new Page.











Once the page is created now add the web application as a portlet.Select the web application from the “Undefined” category and click “add”.

The application will be added under the new page we created.

























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

Thursday, November 10, 2011

LifeRay With OpenID


In This article, we will see how we can configure the OpenID server and link that to the LifeRay Portal Server. For this article I have used the Atlassian Crowd Server as OpenID server. This article goes in steps.

1.    What is an OpenID ?
2.    Benefits of OpendID
3.    How Does It Work
4.    Backend Library
5.    Download the Atlassian Crowd OpenID Server.
6.    Configure the Crowd Open ID Server.
7.    Configure LifeRay with the Crowd Open ID Server.
8.    Create a user in Crowd OpenID Server.
9.    Generate OpenID for the User.
10. Login into LifeRay using OpenID.

This article mainly focuses on OpenID details, configuration of LifeRay with Atlassian's CrowdID OpenID server.

1. What is an OpenID?

OpenID is an open, decentralized, free framework for user-centric digital identity.

OpenID starts with the concept that anyone can identify themselves on the Internet the same way websites do-with a URI (also called a URL or web address). Since URIs are at the very core of Web architecture, they provide a solid foundation for user-centric identity.


2. Benefits of OpenID

From end user View, An OpenID is a single username and password that lets you login to any OpenID-enabled site. OpenID makes remembering different usernames and passwords for different sites a thing of the past.

From Website View, facilitates registration for end users.

The end purpose of OpenID is to keep all the sensible information in the provider so that it's not spread through all the websites where the user has an account. This makes it much easier to protect and keep up to date.

3. How does it work?

  1. User selects an OpenID Provider and creates an account in it. The provider gives the user a unique URL that identifies him.
  2. User finds a new website and wants to create an account. He finds out happily that the website supports OpenID (it's an OpenID consumer).
  3. User logs in with his OpenID URL
  4. The website uses the URL to contact the OpenID provider of the user and requests it some information to be able to create the new account for the user
  5. The user is redirected to his provider's website to:
    1. Login to demonstrate he is the owner of the URL
    2. Accept the request for information from the original website (the providers usually allow maintaining several profiles and the user can select which one to use)
  6. The user is then redirected to the original website with all the necessary information
  7. The website takes that information and creates an account for the user (only the first time) and logs him in
  8. The user logs in

4. Backend Library

LifeRay uses OpenId4java as the backend library to implement the OpenID functionality. This library was chosen because:
  • It is free software with a License compatible with Life ray’s (Apache License 2.0)
  • It seems to have the largest community among the alternatives

5. Download the Atlassian Crowd Server.

Download the Crowd OpenID server from Here .

6. Configure the Crowd Open ID Server.

The first step in configuring the Crowd OpenID server are ,

Specify your Crowd Home directory by editing the configuration file at CROWD-INSTALLATION/WEB-INF/classes/crowd-init.properties for Unix(if working in Unix) and
windows(if working for windows)

crowd.home=/usr/crowd (I changed the directory name to crowd)

2. Go To /usr/crowd/apache-tomcat/conf/Catalina/localhost and open the file crowd.xml (else create one with the data)

Change the docBase with the correct path of crowd-webapp like

<Context path="/crowd" docBase="/usr/crowd/crowd-webapp" debug="0" reloadable="false">
..
..
..
</Context>
3. Go to the Location, /usr/crowd/crowd-openidserver-webapp/WEB-INF/classes
and modify the crowd.properties like,

application.name                       crowd-openid-server
application.password                 password
application.login.url                   http://localhost:8095/openidserver

crowd.server.url                        http://localhost:8095/crowd/services/

session.isauthenticated              session.isauthenticated
session.tokenkey                       session.tokenkey
session.validationinterval           0
session.lastvalidation                 session.lastvalidation

Modify the crowd.server.url and application.login.url.

4. Go to the Location, /usr/crowd/apache-tomcat/conf/Catalina/localhost
and create a file(if not available) openidserver.xml with the following content

<Context path="/openidserver" docBase="../../crowd-openidserver-webapp" debug="0">

    <Resource name="jdbc/CrowdIDDS" auth="Container" type="javax.sql.DataSource"
              username="sa"
              password=""
              driverClassName="org.hsqldb.jdbcDriver"
              url="jdbc:hsqldb:${catalina.home}/../database/crowdopenidserverdb"
              minEvictableIdleTimeMillis="4000"
              timeBetweenEvictionRunsMillis="5000"
              maxActive="20"
            />

<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>

</Context>

If the file exists, add the line leaving the rest untouched,

<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>

5. Once all these modifications are done. Restart the tomcat server . The url will be

For OpenID server: http://localhost:8095/openidserver/login.action

6. Once the configurations are done , Start the Tomcat server in the same directory location and access the url in a browser and follow the steps,


Since the Crowd OpenID server is available only for a trail version, it will ask for a Evaluation key. We need to register with Atlassian Crowd Server and get a key from the web site. Once the get the key , the server will allow us to move further .The next step would be to configure Type of Database

 










The Next Step would be to select the options,












Give a name to the Deployment Title, Value to Session Time Out and Base URL.

The next step would be to configure the Internal Directory, I just gave the Name and took the default value for others

















The Next step would be to configure and Administrator account,












The next step is to configure the Integrated applications .I have taken the default options.










And Then the final step, 







Once the configuration is done correctly, a login screen will be shown. We can login using the username and password which we created as a administrator.

7. Configure LifeRay with the Crowd Open ID Server.

The Configuration of LifeRay with Crowd OpenID server is done in the 3 step above.

8. Create a User in Crowd OpenID Server.

Login in as administrator (the user that we created while configuring the Crowd OpenID server).Once we login into the Server, we see the screen

















Select Users on the top panel . In the Left pane , click on the Add User. 
 

 














 Create a user with all required details



 













9. Generate OpenID for the User.

Once the user is configured, open the url
http://localhost:8095/openidserver/login.action in a browser and login using the username and password that we created before.









Once we login, we are given with a OpenID.
 











10. Login into LifeRay using OpenID.

Start the LifeRay Server and sign in using the OpenID option under the Sign In portal.

 









Enter the OpenID url that we got and click sign in. It will take us to the OpenID server. Once we are logged in, we see the following page. Select the Allow Always option.











Once we select the Allow Always, we will be taken back to the LifeRay server










By This we complete the Configuration of OpenID server with Liferay.
More Articles To Come , Happy Coding..






Read More