Results 1 to 3 of 3

Thread: redirecting to different pages based on User Role - struts2

  1. #1

    Default redirecting to different pages based on User Role - struts2

    I am able to authenticate the user from the database but there are different users in my app so I want to redirect them to their different homepages based on their Role.

    The best way I guess would be by checking the user role in a struts action and then redirecting to appropriate page. But how do I do that. Does spring security set session variables storing authentication information.

    If yes, then how do I access them in a struts action. Also how do I access the username and password after login

  2. #2
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    You have a few options. SecurityContextHolder.getContext().getAuthentication().getAuthorities() . Spring integrates with J2EE so you can also use Struts2's PrincipalAware or HttpServletRequest.isUserInRole(String).

    PS: Ensure that your springSecurityFilterChain is the first filter-mapping in your web.xml.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #3

    Default

    Thank you for your help, now I am able to get authentication info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •