 |
Support & downloads > |
 |
 |
 |
Portal and other libraries required for writing a Portal Authentication Filter
|
| | | Question | | IBM WebSphere Portal and other libraries that are required to write a portal authentication filter are discussed in this technote. | | | | | | Answer | Portal authentication filters can be used to intercept or extend the Portal login, logout, session timeout, and so on. This technote discusses how to implement a ExplicitLoginFilter in which information regarding the user, client IP address, and the date/time stamp could be written to a log file.
1. Create a Java project in Rational Application Developer (7.5 used in this example).
2. The following libraries must be configured for the above Java project:
<WSAS_ROOT>/plugins - com.ibm.ws.runtime_6.1.0.jar
<WAS_ROOT>/java/jre/lib - security.jar
<WP_ROOT>/base/wp.auth.base/shared/app - wp.auth.base.jar
<WP_ROOT>/base/wp.base/shared/app - wp.base.jar
3. Import the following packages in your class that extends ExplicitLoginFilter: import javax.security.auth.Subject; import javax.security.auth.login.LoginException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.ibm.portal.auth.exceptions.LoginException; import com.ibm.portal.auth.ExplicitLoginFilter; import com.ibm.portal.auth.ExplicitLoginFilterChain; import com.ibm.portal.auth.FilterChainContext; import com.ibm.portal.auth.exceptions.AuthenticationException; importcom.ibm.portal.auth.exceptions.AuthenticationFailedException; import com.ibm.portal.auth.exceptions.PasswordInvalidException; import com.ibm.portal.auth.exceptions.SystemLoginException; import com.ibm.portal.auth.exceptions.UserIDInvalidException; import com.ibm.portal.security.SecurityFilterConfig; import com.ibm.portal.security.exceptions.SecurityFilterInitException; import com.ibm.websphere.security.WSSecurityException; The package with the strikethrough above is not required as explained below.
If there are two classes with the same name that exist in different packages, the compiler might encounter an ambiguous reference and the class using these imports will not compile. An alternate way is to select the one you refer to most often, import it, and refer to the other one by its full name every time.
In your code, define the LoginException in the package, com.ibm.portal.auth.exceptions, as shown in the example below: public void login(HttpServletRequest req, HttpServletResponse resp, String userID, char[] password, FilterChainContext portalLoginContext, Subject subject, String realm, ExplicitLoginFilterChain chain) throws javax.security.auth.login.LoginException, WSSecurityException, PasswordInvalidException, UserIDInvalidException, AuthenticationFailedException, AuthenticationException, SystemLoginException, com.ibm.portal.auth.exceptions.LoginException {
4. Implement the login method from the ExplicitLoginFilter interface.
5. Build the class or use JAVAC to compile the class. Then create a Java archive by using the .jar utility. Place the .jar file in the <WP_ROOT>/shared/app directory.
6. Add a custom property to the WPAuthenticationService Resource Provider in the WebSphere Admin console by placing the parameter below to refer to the above class you developed:
login.explicit.filterchain = yourco.MyCustomLoginFilterClass
7. Restart Portal. | | | | | | | | |
 |
| IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml. |
 |
 |
 |
| Please take a moment to complete this form to help us better serve you. |
 |
 |
 |
|
|
|
 |
 |
| Product categories: |
 |
| | Software |  |
| | Organizational Productivity, Portals & Collaboration |  |
| | Portals |  |
| | WebSphere Portal |  |
| | Application Development |  |
 |
| Operating system(s): |
| |
AIX, HP-UX, Linux, Solaris, Windows
|
 |
| Software version: |
| |
6.1, 6.1.0.1
|
 |
| Reference #: |
| |
1366056
|
 |
| IBM Group: |
| | Software Group |
 |
| Modified date: |
| | 2009-02-19 |
 |
|