相关疑难解决方法(0)

找不到UsernamePasswordAuthenticationToken的AuthenticationProvider

我的web.xml配置是

<filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
Run Code Online (Sandbox Code Playgroud)

这是我的安全配置

    <intercept-url pattern="/*" access="ROLE_USER" />
    <intercept-url pattern="/*.ico"  filters="none" />


</http>

 <beans:bean id="customAuthenticationProvider" class="net.spring3.provider.MyAuthProvider"  />

    <authentication-manager>

        <authentication-provider ref="customAuthenticationProvider" /> 

    </authentication-manager>
Run Code Online (Sandbox Code Playgroud)

这是我的customAuthProvider类

public class MyAuthProvider implements AuthenticationProvider  {


    @Override
    public boolean supports(Class<? extends Object> arg0) {
        // TODO Auto-generated method stub
        return false;
    }


     @SuppressWarnings("serial")
        private static Map<String, String> SIMPLE_USERS = new HashMap<String, String>(2) {{
            put("joe", "joe");
            put("bob", "bob");
        }};

        @SuppressWarnings("serial" )
        private static List<GrantedAuthority> AUTHORITIES = new ArrayList<GrantedAuthority>(1) {{
            add(new GrantedAuthorityImpl("ROLE_USER"));
        }}; …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-security spring-3

16
推荐指数
2
解决办法
4万
查看次数

标签 统计

java ×1

spring ×1

spring-3 ×1

spring-mvc ×1

spring-security ×1