View Javadoc

1   package org.acegisecurity.ui.switchuser;
2   
3   import java.util.List;
4   
5   import org.acegisecurity.Authentication;
6   import org.acegisecurity.GrantedAuthority;
7   import org.acegisecurity.userdetails.UserDetails;
8   
9   /**
10   * Allows subclasses to modify the {@link GrantedAuthority} list that will be assigned to the principal
11   * when they assume the identity of a different principal.
12   *
13   * <p>Configured against the {@link SwitchUserProcessingFilter}.
14   *
15   * @author Ben Alex
16   * @version $Id$
17   *
18   */
19  public interface SwitchUserAuthorityChanger {
20  
21      /**
22       * Allow subclasses to add or remove authorities that will be granted when in switch user mode.
23       *
24       * @param targetUser the UserDetails representing the identity being switched to
25       * @param currentAuthentication the current Authentication of the principal performing the switching
26       * @param authoritiesToBeGranted all {@link GrantedAuthority} instances to be granted to the user,
27       * excluding the special "switch user" authority that is used internally (guaranteed never null)
28       */
29      void modifyGrantedAuthorities(UserDetails targetUser, Authentication currentAuthentication, List authoritiesToBeGranted);
30  }