I have multiple logins for my applications. I have defined security filters in two different configurations.
This one has @Order(1) for admin:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/admin/**")
.authenticated()
.and()
.formLogin()
.loginPage("/admin/login").defaultSuccessUrl("/admin")
.usernameParameter("username").passwordParameter("userpassword")
.permitAll()
.and()
.logout().logoutSuccessUrl("/admin/login")
.permitAll().and()
.csrf();
}
And other one:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/tasker/**")
.authenticated()
.and()
.formLogin()
.loginPage("/tasker/login")
.usernameParameter("taskeremail").passwordParameter("taskerpassword")
.permitAll()
.and()
.logout().logoutSuccessUrl("/")
.permitAll().and()
.csrf();
}
The first one for admin works fine but the second one is not even securing the /tasker/** urls.
Found simular questions but not answerd. Even I could not find anything helpful on spring reference. Please help.