0

I am developing a web application with Spring Security. My application uses Java config completely, it doesn't have any XML.

My application has two login pages, one for front user login, another for back admin user login. I have configured front user login:

http
    .formLogin()
        .loginPage("/front/login")
        .permitAll()
        .defaultSuccessUrl("/")
        .failureUrl("/front/login?error=1")
        .loginProcessingUrl("/front/logining")
        .usernameParameter("mobile")    
        .passwordParameter("password"); 

How can I configure back admin user login? I have tried to add another fromLogin, but it's not working, the second fromLogin covers the first formLogin.

1

1 Answer 1

0

Have you tried the accepted answer?
Spring Security 3.2.1 Multiple login forms with distinct WebSecurityConfigurerAdapters

Another aproach:

Different user login can be handled by the same formLogin by checking the Role

Basically you login once and you enable specific paths for specific roles. "http.authorizeRequests() .antMatchers("/privateAdminActions/**").hasRole("ADMIN")"

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.