Showing posts with label Login. Show all posts
Showing posts with label Login. Show all posts

Approach for customizing IBM WebSphere Portal login-logout mechanism

WebSphere Portal server comes with its own default login/logout procedure but sometimes it's required to extend this default behavior to meet our own requirements. For example, it could be necessary that a user needs to be registered and De-registered at a local security system upon login and logout. 

The following articles describes you how the portal's login procedure works, how it can be configured, and what programming interfaces can be used to extend it. 

Understanding WebSphere Portal login procedure

WebSphere portal executes certain login / logout command whenever any portal user logs in out of the portal. The classes for login/logout mechanism are specified in the below property file

/AppServer/lib/app/config/services/ConfigService.properties

Default values for these command are: 

command.login = LoginUserAuth
command.logout = LogoutUserAuth

The default login command executes the following sequence:
  • WebSphere Application Server login
  • WebSphere Portal JAAS login
  • WebSphere Portal user login
  • Resume session
  • Browsers redirect (302)
The default logout command executes following sequence:
  • Suspend User Session
  • Portlet user logout
  • WebSphere Application Server logout
  • Browser redirect (302)

How to customize WebSphere Portal Default Login Screen?

WebSphere Portal comes with a default login screen with parameters like user ID, password, first name, last name, etc. Based on your architectural requirements, you may want to change the look and feel of this default login screen to better meet your needs. 

To change the look and feel, change the following jsp

WebSphere\AppServer\installedApps\nodename

\wps.ear\wps.war\screens\html\login.jsp

Or, you can change the login page in 

WebSphere\AppServer

\config\cells\nodename\applications\wps.ear\deployments\wps\wps.war\WEB-INF\web.xml

where you can define where to redirect when a protected page is accessed. 

To change the login mechanism, look for the subclass LoginUserAuth, put the classfile in the classpath, and change it in the ConfigService.properties command.login = LoginUserNoAuth to your package name. This change should reflect the changes in the login mechanism based on your code.

Steps for extending the Websphere Portal login/logout procedure

As mentioned in my previous post, WebSphere portal executes certain login / logout commands when users login /logout to the portal server.

So the question here is can we extend or modify these default command classes to meet our business requirements and the answer is "Yes" we can.

The command classes define several methods that are called during execution of the command. So we need to simply override these default methods to extend this mechanism. These commands works as below: 
LoginUser.execute()
{
Step1: doPreLogin() // Empty in default command
Step2: doAuthenticate() // Step 1-3 of the login sequence (See previous post)
Step3: doPostLogin() // Step 4 of the login sequence 
Step4: Redirection // Step 5 of the login sequence 
Step5: onAuthenticationError() // only in case of an authentication error
}

LogutUser.execute()
{
Step1: doPreLogout() // Step 1 of the logout sequence (See previous post)
Step2: PortletLogout // Step 2 of the logout sequence
Step3: doPostLogout() // Step 3 of the logout sequence
Step4: Redirection // Step 4 of the logout sequence
Step5: onUserSessionTimeOut() // only in case of an user session timeout
}

In order to modify or extend these sequences, derive a child command (class) from com.ibm.wps.engine.LoginUserAuth (or com.ibm.wps.engine.LogoutUserAuth) and overwrite the respective methods.

How to reset the administrator's password in the file registry

Have you ever been in a situation where you have spent lot of hours in installing and configuring WebSphere Portal and WebSphere Application Server as per your project''s requirement and after some time you forgot the password that you set for both the servers.

One solution is to uninstall and install both the server and start all over again but that again could be time consuming task. Another solution would be to reset the passwords.

Here is the way how you can achieve this. Very useful tech note from IBM.

http://www-01.ibm.com/support/docview.wss?rs=688&context=SSHRKX&dc=DB560&dc=DB520&uid=swg21392427&loc=en_US&cs=UTF-8&lang=en&rss=ct688websphere

http://www-10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+WebSphere+Portal+7+Product+Documentation#action=openDocument&res_title=Updating_user_ID_and_passwords_wp7&content=pdcontent