Remove “Using default security password” on Spring Boot

后端 未结 18 2191
小鲜肉
小鲜肉 2020-12-04 12:13

I added one custom Security Config in my application on Spring Boot, but the message about \"Using default security password\" is still there in LOG file.

Is there a

18条回答
  •  天命终不由人
    2020-12-04 12:32

    Check documentation for org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration there are conditions when autoconfig will be halt.

    In my case I forgot to define my custom AuthenticationProvider as bean.

    @Configuration
    public class SecurityConfig extends WebSecurityConfigurerAdapter {
    
        @Override
        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
            auth.authenticationProvider(getAuthenticationProvider());
        }
    
        @Bean
        AuthenticationProvider getAuthenticationProvider() {
            return new CustomAuthenticationProvider(adminService, onlyCorporateEmail);
        }
    }
    

提交回复
热议问题