对于HttpSecurity类型,方法和()未定义

时间:2015-06-08 15:35:02

标签: angularjs spring-boot

我试图遵循这个example,这基本上是一些代码,实际上使angular.js上的登录失效。

我得到"方法和()未定义类型HttpSecurity"

这是我Code(第89行)的一部分:

@EnableWebMvcSecurity
@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class SecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.httpBasic()

        .and().authorizeRequests()
            .antMatchers("/login", "/error" , "/error.html")
            .permitAll()
            .anyRequest()
            .fullyAuthenticated()
            /*.permitAll().anyRequest().authenticated()*/

        .and()
            .logout()
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/")
            .permitAll()

        .and()
            .csrf().csrfTokenRepository(csrfTokenRepository())

        .and()
            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)

        .and() /* HERE IS WHERE I GET THE WARNING */
            .sessionManagement()
            .maximumSessions(1)
            .expiredUrl("/expired")
            .maxSessionsPreventsLogin(true)
            .sessionRegistry(sessionRegistry());


    }

    ...more code here

    }

1 个答案:

答案 0 :(得分:4)

grep已经返回addFilterAfter()的实例,因此您只需先调用HttpSecurity,而无需先调用sessionManagement()