Authentication Filter implementation

In WPS, Authentication filters are used to show custom portal pages after logging through login Portlet.

One possible use case could be like this,

If user Dave login to portal, he should see Finance portal page
If user Andrew login to Portal, he should see Sports portal page

Other use case that i worked with is,

User login using Login Portlet (My own developed Login Portlet) and after
authentication user will be redirected to custom screens of login portlet itself
and after providing certain information on custom screens, he will be logged in to portal.

For all these kind of use cases, You need to write your own login portlet and implement Authentication Filters

I am just gathering all the technotes that i came across while working with Authentication Filters

Setting service configuration properties, in this case it would be WP Authentication Service

This New security APIs in WebSphere helped me lot to understand following, hope it will help for all reader as well.

a) LoginPortletService and various filters
b) Capabilities of the remember me cookie
c) Remember me cookie portlet service
c) Using the Puma Service in a public context and
d) Authentication filters

Portal and other libraries required for writing a Portal Authentication Filter


if you find any error at portal startup, after creating Custom Properties in WP Authentication Service on WAS,

11 comments:

rub said...

Hello, could you send me the source code of your portlet?

Neeraj Sidhaye said...

Could you please tell me your requirement or where are you getting problem, we can solve quickly.

Santiago Carbonell said...

Good blogger,

I need to retrieve some URL parameters inside a Portlet, so I need to create a filter. I put my filter into portalserver/shared/app
and change web.xml into wp_profiles/config/.../wps.war/WEB-INF
but I always obtaing ClassNotFoundException

Can you help me?

Thanks

Neeraj Sidhaye said...

Hi Santiago,

could you please tell me your use case? I would be more than happy to resolve your issue with better approach.

Santiago Carbonell said...

Neeraj, thanks for your response.

We are using WCL27, an elearning platform that use Websphere Portal 6.1 as J2EE server. I need to access some resources without authentication, so I thought create a portlet and pass the username and password to it and do the authenticate and then redirect to the url inside the portal, but to pass the username and password to the portlet outside the portal, I need to use a filter.

I'm trying to use this Technical Library from IBM:

http://www.ibm.com/developerworks/websphere/library/techarticles/0707_lynn/0707_lynn.html

but appears ClassNotFoundException when I try to create this filter

Thanks

Neeraj Sidhaye said...

Hi Santiago,

sorry for replying late, was quite busy....
I have one question...
How you will be passing username and password to portlet directly?
is that portlet places on annomoyous page?
Let me understand again here,
you will hit a portal page and page has a portlet. Filter will come in picture and there you will get username, password and will pass to portlet and porlet will do authentication. is that right?

if you are using JSR286, you can use portlet filter.
If not JSR 286, you can use normal J2EE filter and put that filter into your portlet application BUT not at portal level filter.

please let me know

Santiago Carbonell said...

Neeraj,

I'm using JSR-168.

I'm trying to access the portlet using an anonymous page in Websphere Portal, using a URL with parameters. To pass username and password to the portlet I'm trying to use a Filter, so I think that this filter must be in Websphere not Websphere Portal. Is this correct?

So where I need to put this filter in Websphere, so it do not throw the error: ClassNotFoundException? I think that this error is because Websphere can't found the filter class. I put jar's filter in $portalserver$/shared/app but nothing happens. Is this location right?

Thanks

Santiago Carbonell said...

Neeraj,

I finally got that didn't appear ClassNotFoundException when creating a new Filter in Websphere but now appears: java.lang.ClassCastException: com.ibm.ws.portletcontainer.event.EventDeserializeFilter incompatible with javax.portlet.filter.PortletFilter

I think that problem is that I'm using javax.servlet.Filter instead of some classes in Websphere Portal 6.1 but I'm not sure. I'm using eclipse 3.1

Thanks for your time

Chitra said...

Hi Neeraj, We have migrated our Application to WPS 7.0 from 6.0.4. Login in our case happens via Siteminder, post login is handled in LoginUserAuth class. Is it possible to remove loginUserAuth and implement redirection via Authentication Filter? As per the code for Explicit login Filter goes it first calls login method and then redirect. I want to avpoid login and just perform postLogin Activities. Is this a valid scenario

Unknown said...

Hello Neeraj,
using the multi tenancy architecture approach in the IBM Portal Server,we have implemented Tenanat based Virtual Portals for each tenant have unique url binding with Unique Realm (LDAP Repository).now my requirement is we should maintain common URL.from the common URL based on the login user it will be redirect to the Specific Tenant.
will this Authentication Filters Approach will work out

Regards
Pratap D

Shinku said...

Hello Neeraj,
While redirecting from SessionValidator filter , i am getting "too many redirects" error in browser
Please tell me what would be the correct implementation of redirection from SessionValidator filter