diff --git a/core/src/main/java/org/springframework/security/ui/switchuser/SwitchUserProcessingFilter.java b/core/src/main/java/org/springframework/security/ui/switchuser/SwitchUserProcessingFilter.java index d76cf2d156..67da00b8d1 100644 --- a/core/src/main/java/org/springframework/security/ui/switchuser/SwitchUserProcessingFilter.java +++ b/core/src/main/java/org/springframework/security/ui/switchuser/SwitchUserProcessingFilter.java @@ -69,27 +69,34 @@ import javax.servlet.http.HttpServletResponse; /** - * Switch User processing filter responsible for user context switching.
This filter is similar to Unix 'su' - * however for Spring Security-managed web applications. A common use-case for this feature is the ability to allow - * higher-authority users (i.e. ROLE_ADMIN) to switch to a regular user (i.e. ROLE_USER).
- *This filter assumes that the user performing the switch will be required to be logged in as normal (i.e. + * Switch User processing filter responsible for user context switching. + *
+ * This filter is similar to Unix 'su' however for Spring Security-managed web applications. + * A common use-case for this feature is the ability to allow higher-authority users (i.e. ROLE_ADMIN) to switch to a + * regular user (i.e. ROLE_USER). + *
+ * This filter assumes that the user performing the switch will be required to be logged in as normal (i.e.
* ROLE_ADMIN user). The user will then access a page/controller that enables the administrator to specify who they
* wish to become (see switchUserUrl).
* Note: This URL will be required to have to appropriate security contraints configured so that only users of that
- * role can access (i.e. ROLE_ADMIN).
On successful switch, the user's SecurityContextHolder will be updated to reflect the
- * specified user and will also contain an additinal {@link org.springframework.security.ui.switchuser.SwitchUserGrantedAuthority
- * } which contains the original user.
To 'exit' from a user context, the user will then need to access a URL (see exitUserUrl) that
- * will switch back to the original user as identified by the SWITCH_USER_GRANTED_AUTHORITY.
To configure the Switch User Processing Filter, create a bean definition for the Switch User processing + * role can access (i.e. ROLE_ADMIN). + *
+ * On successful switch, the user's SecurityContextHolder will be updated to reflect the
+ * specified user and will also contain an additinal
+ * {@link org.springframework.security.ui.switchuser.SwitchUserGrantedAuthority} which contains the original user.
+ *
+ * To 'exit' from a user context, the user will then need to access a URL (see exitUserUrl) that
+ * will switch back to the original user as identified by the SWITCH_USER_GRANTED_AUTHORITY.
+ *
+ * To configure the Switch User Processing Filter, create a bean definition for the Switch User processing
* filter and add to the filterChainProxy.
* Example:
* <bean id="switchUserProcessingFilter" class="org.springframework.security.ui.switchuser.SwitchUserProcessingFilter"> * <property name="authenticationDao" ref="jdbcDaoImpl" /> * <property name="switchUserUrl"><value>/j_spring_security_switch_user</value></property> * <property name="exitUserUrl"><value>/j_spring_security_exit_user</value></property> - * <property name="targetUrl"><value>/index.jsp</value></property></bean>+ * <property name="targetUrl"><value>/index.jsp</value></property></bean> + * * * @author Mark St.Godard * @version $Id$ @@ -102,8 +109,6 @@ public class SwitchUserProcessingFilter implements Filter, InitializingBean, App private static final Log logger = LogFactory.getLog(SwitchUserProcessingFilter.class); - // ~ Static fields/initializers - // ============================================= public static final String SPRING_SECURITY_SWITCH_USERNAME_KEY = "j_username"; public static final String ROLE_PREVIOUS_ADMINISTRATOR = "ROLE_PREVIOUS_ADMINISTRATOR"; @@ -116,9 +121,6 @@ public class SwitchUserProcessingFilter implements Filter, InitializingBean, App private String switchUserUrl = "/j_spring_security_switch_user"; private String targetUrl; private SwitchUserAuthorityChanger switchUserAuthorityChanger; - - // ~ Instance fields - // ======================================================== private UserDetailsService userDetailsService; //~ Methods ========================================================================================================