How to login two accounts in two login forms simultaneously in Spring MVC? -
so have 2 form logins. , customer login. when login using account in login page it's okay when login in customer login page using customer account logout logged in account in page.
what want simultaneously log in account in login , customer account in customer login.
i have separated 2 login forms in websecurityconfig:
@configuration @enablewebsecurity public class websecurityconfig { @autowired dbauthenticationservice dbauthenticationservice; @autowired public void configureglobalsecurity(authenticationmanagerbuilder auth) throws exception { auth.userdetailsservice(dbauthenticationservice); } @configuration @order(1) public static class webconfigurationadapter1 extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http .antmatcher("/am*").authorizerequests().anyrequest().hasrole("am") .and() .exceptionhandling() .accessdeniedpage("/am403") .and() .formlogin() .loginpage("/login_am") .loginprocessingurl("/ampostlogin") .defaultsuccessurl("/amchatpage") .failureurl("/login_am?error=true") .and().logout().logouturl("/amlogout").logoutsuccessurl("/amlogoutsuccessful") .and().csrf().disable(); } } @configuration public static class webconfigurationadapter2 extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http .antmatcher("/customer*").authorizerequests().anyrequest().hasrole("customer") .and() .exceptionhandling() .accessdeniedpage("/customer403") .and() .formlogin() .loginpage("/login_customer") .loginprocessingurl("/customerpostlogin") .defaultsuccessurl("/customerchatpage") .failureurl("/login_customer?error=true") .and().logout().logouturl("/customerlogout").logoutsuccessurl("/customerlogoutsuccessful") .and().csrf().disable(); } } } can me how make happen? should make both , customer simultaneously logged in. i'm still new spring mvc. tried using cookies , applied in controller doesn't work.
Comments
Post a Comment