Results 1 to 3 of 3

Thread: How to protect several groups with different login pages

  1. #1
    Join Date
    Jan 2005
    Posts
    16

    Default How to protect several groups with different login pages

    My web application has several groups of pages. One group is unlimited, the second group is for junior user, and the third is for senior user. Each user type has different login information. How can I use Acegi to configure these setting? Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Acegi Security doesn't understand the notion of groups. It only understands "principals have GrantedAuthorty[]s".

    You can write your own Authentication object which holds Group[]s if you like, and write AccessDecisionVoter[]s that can iterate them.

    Alternatively, what most people do is write their AuthenticationDao (assuming they're using DaoAuthenticationProvider) to iterate group memberships and add the associated GrantedAuthority[]s to a "global GrantedAuthority[]" returned by the AuthenticationDao. Thus the mapping happens as close to the custom (ie your) application as possible, avoiding modifying the Acegi Security framework or deviating from its typical implementation and patterns. AuthenticationDao is also an interface most reasonable sized applications go and implement anyway, so it's little effort adding an iterator to the implementation.

    The only time I'd recommend the additional effort of a Group[]s property inside Authentication is if your AccessDecisionVoters really needed to understand the "source" of the GrantedAuthority[]s (ie via a certain Role or directly against the principal). Then again, you could easily stick to the recommended AuthenticationDao approach and simply extend SecurityConfig to have a "group" property. Thus interested AccessDecisionVoters could obtain the information, whilst those that don't care could just use the SecurityConfig superclass as per normal.

    As with Spring, in Acegi Security there are typically many different ways to approach a problem due to the interface-based design.

  3. #3
    Join Date
    Jan 2005
    Posts
    16

    Default

    Thanks, Ben, I got it. What I will do is to customize my own DaoAuthitication.

Similar Threads

  1. acegi + CAS going in loop after login
    By mcecca in forum Security
    Replies: 3
    Last Post: Sep 30th, 2005, 02:56 PM
  2. login page with url parameter
    By break2stand in forum Security
    Replies: 2
    Last Post: Jun 2nd, 2005, 12:35 AM
  3. Replies: 1
    Last Post: Feb 15th, 2005, 01:05 PM
  4. Acegi - Login Tapestry
    By john017 in forum Security
    Replies: 1
    Last Post: Feb 4th, 2005, 01:11 AM
  5. Replies: 2
    Last Post: Nov 12th, 2004, 06:17 AM

Posting Permissions

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