• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Forward to handler

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");

}
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic