This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Forward to handler  RSS feed

 
Kev D'Arcy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm using client certificates as my log in mechanism in my webapp and I'm wondering if there's a way to have the login process redirected to a handler class before it hits a jsp/jsf page. What I need to happen is that once the user has been authenticated and authorised, the roles that the user is assigned to will dictate the contents of a radio button list on the first page that the user sees. The only way I know of doing this is by forwarding the request to a servlet, carrying out the necessary processing and then redirecting the user to the required page.

Is there a neater way of doing this?

Kev
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kev D'Arcy:
Hi all,

I'm using client certificates as my log in mechanism in my webapp and I'm wondering if there's a way to have the login process redirected to a handler class before it hits a jsp/jsf page. What I need to happen is that once the user has been authenticated and authorised, the roles that the user is assigned to will dictate the contents of a radio button list on the first page that the user sees. The only way I know of doing this is by forwarding the request to a servlet, carrying out the necessary processing and then redirecting the user to the required page.

Is there a neater way of doing this?

Kev



My own idea(I may be wrong ) is add an ActionEvent to the command button, Once the button is clicked , The following is executed

FacesContext context=FacesContext.getCurrentInstance();
Application application=context.getApplication();
NavigationHandler navigation=application.getNavigationHandler();
//do all role checking here and set settings for radio button
// visibilty for next page

if (authorized){
navigation.handleNavigation(context,null,"\faces\nextPage.jsp");
}
if (NotAuthorized){
navigation.handleNavigation(context,null,"\faces\errorPage.jsp");

}
 
Ravindra Rawat
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably not related to JSF but can be handled by having a servlet filter which will act on unauthenticated requests and set appropriate role before proceeding to any resource in your application.

http://java.sun.com/products/servlet/Filters.html

Warm Regards
Ravindra
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!