Let us now implement another security model that uses a custom authentication process instead of the default:
- First, create a new security context definition, AppSecurityModelB, which presents the overriding of the http.formLogin().loginProcessingUrl() and the customization of the authentication manager and its providers:
@Configuration @EnableWebSecurity public class AppSecurityModelB extends WebSecurityConfigurerAdapter{ @Autowired private AuthenticationProvider appAdminProvider; @Autowired private AuthenticationProvider appHRProvider; @Autowired private AuthenticationManager appAuthenticationMgr; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { } @Override protected void configure(HttpSecurity ...