Multiple Social Logins with spring

318 views Asked by At

I have multiple WebSecurityConfigurerAdapters in my webapp one for each part of the app and need to have multiple "login with FB/Google" buttons with different behaviours.

I have been trying to configure multiple SpringSocialConfigurers one per each WebSecurityConfigurerAdapter but this doesn't seem to work as only one gets used at a time.

Any ideas on how to fix this?

@Configuration
@Order(1)
public static class ASecurityConfiguration extends WebSecurityConfigurerAdapter {

...

final EventRegistrationAuthenticationHandler authHandler = new EventRegistrationAuthenticationHandler();
final SpringSocialConfigurer socialSecurityConfigurer = new SpringSocialConfigurer();
socialSecurityConfigurer.alwaysUsePostLoginUrl(true);
socialSecurityConfigurer.postLoginUrl("/asd");

And

@Configuration
@Order(3)
public static class BSecurityConfiguration extends WebSecurityConfigurerAdapter {

...

final SpringSocialConfigurer socialSecurityConfigurer = new SpringSocialConfigurer();
socialSecurityConfigurer.alwaysUsePostLoginUrl(true);
socialSecurityConfigurer.postLoginUrl("/gogogoogogo");
0

There are 0 answers