POST方法不适用于permitAll

时间:2018-01-11 08:11:41

标签: spring spring-mvc spring-security

我有以下弹簧安全配置:

http.authorizeRequests()
                .antMatchers(
                        "/login",
                        "/webResources/**",
                        "/app/**",
                        "/",
                        "/core/landingPage",
                        "/api/genders",
                        "/ums/signup").permitAll()
                .and()
                .authorizeRequests()
                    .antMatchers("/**").authenticated()
                .and().formLogin()
                .loginPage("/login").permitAll()
                .usernameParameter("username")
                .passwordParameter("password")
                .and().csrf()
                .and().exceptionHandling().accessDeniedPage("/accessDenied");

问题是/ ums / signup是一个PostMapping,它不起作用。每当我尝试点击此端点时,它会将我重定向到登录页面。我错过了什么?

1 个答案:

答案 0 :(得分:-1)

覆盖重载的配置方法public void configure(WebSecurity web) throws Exception并添加

web.ignoring().antMatchers("/ums/signup");
相关问题