在SpringBoot中进行身份验证后,从Authentication对象中清除凭证

时间:2019-04-12 13:29:11

标签: spring spring-boot spring-mvc authentication spring-security

我的WebSecurityConfig文件中有一个使用此方法的SpringBoot 2.1.4.RELEASE

  @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth
                .userDetailsService(userSecurityService)
                .passwordEncoder(passwordEncoder());

    }

我想在身份验证后从Authentication对象中清除凭据,

我将方法更改为

@Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth
                .userDetailsService(userSecurityService)
                .eraseCredentials(false);
                .passwordEncoder(passwordEncoder());

    }

但是出现编译错误:

The method eraseCredentials(boolean) is undefined for the type DaoAuthenticationConfigurer<AuthenticationManagerBuilder,UserSecurityService>

0 个答案:

没有答案