package org.jsecurity.spring.servlet;

import org.jsecurity.web.servlet.SecurityContextFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;

/**
 * TODO class JavaDoc
 *
 * @author Les Hazlewood
 */
public class SpringSecurityContextFilter extends SecurityContextFilter {

    public static final String SECURITY_MANAGER_BEAN_NAME_PARAM_NAME = "securityManagerBeanName";

    protected String securityManagerBeanName = "securityManager";

    public String getSecurityManagerBeanName() {
        return securityManagerBeanName;
    }

    public void setSecurityManagerBeanName( String securityManagerBeanName ) {
        this.securityManagerBeanName = securityManagerBeanName;
    }

    public void init() throws Exception {
        String beanName = getFilterConfig().getInitParameter( SECURITY_MANAGER_BEAN_NAME_PARAM_NAME );
        if ( beanName != null ) {
            setSecurityManagerBeanName( beanName );
        }
        super.init();
    }

    protected org.jsecurity.SecurityManager getSecurityManager() {
        ServletContext sc = getFilterConfig().getServletContext();
        ApplicationContext appCtx = WebApplicationContextUtils.getRequiredWebApplicationContext( sc );
        return (org.jsecurity.SecurityManager)appCtx.getBean( getSecurityManagerBeanName() );
    }
}

@@ -491,73 +491,177 @@
 e%22;%0A
-%0A
     p
-rotected String securityManagerBeanName = %22securityManager%22
+ublic static final String DEFAULT_SECURITY_MANAGER_BEAN_NAME = %22securityManager%22;%0A%0A    protected String securityManagerBeanName = DEFAULT_SECURITY_MANAGER_BEAN_NAME
 ;%0A%0A 

made string constant