Here is an example of a custom AuthenticationProvider and a custom UserDetailsService:
@Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void registerGlobalAuthentication(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(customAuthenticationProvider()); } @Bean AuthenticationProvider customAuthenticationProvider() { CustomAuthenticationProvider impl = new CustomAuthenticationProvider(); impl.setUserDetailsService(customUserDetailsService()); return impl ; } @Bean UserDetailsService customUserDetailsService() { } }
Ritesh
source share