Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

User Authentication in Servlet Filters

843841Jan 22 2008 — edited Jan 23 2008
Hi I was hoping someone might have some ideas on a problem I am having with filters. The core problem is no matter what, when I try to retrieve the user through the following call; I always get a null value back as the remote user in my servlet filter.
((HttpServletRequest)request).getRemoteUser();
I should give a little background into the way my app works. I go through a single sign on using basic authentication before I reach the filter and my user is authenticated at this point. I then build a redirect URL that goes to my servlet, and the filter intercepts this incoming request based on the url pattern and I redirect to a specifc jsp page in the servlet. When the filter gets the incoming request, it drops the security credentials and they are always null.

Now I know that a null response typically means your user is not authenticated but my user is authenticated. To me there seems to be no security around my servlet filter or the filter is some how dropping the security credentials.If I bypass my filter and hit the a servlet page directly and use the JSF FacesContext getRemoteUser() call in my backing bean, I can retrieve the remote user no problem. Use the following code;
 
FacesContext facesContext = FacesContext.getCurrentInstance;
facesContext.getExternalContext().getRemoteUser();
I should point out that I am doing this inside a RAD6 environment. I mention this because I saw this posting of someone having a similar problem but there was no response or resolution.

http://issues.apache.org/struts/browse/WW-2121;jsessionid=3DF5DF4F62539F7F1F25A6EF2434087A?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Right now I am re-writing my code to use a servlet that handles the incoming request because it retrieves the getRemoteUser() no problem but I would like to know if anyone has had similar problems with filters in RAD6 or in general. Any suggestions or ideas would be appreciated.

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 20 2008
Added on Jan 22 2008
4 comments
433 views