@Test public void oauth2Callback_multipleMatchingUsers() throws Exception { ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry(); ConnectionFactory<TestApi2> connectionFactory2 = new StubOAuth2ConnectionFactory("clientId", "clientSecret"); connectionFactoryLocator.addConnectionFactory(connectionFactory2); StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository(asList("testuser1", "testuser2")); ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null); providerSignInController.afterPropertiesSet(); MockMvc mockMvc = standaloneSetup(providerSignInController).build(); mockMvc.perform(get("/signin/oauth2Provider").param("code", "authcode").param("state", "STATE") .sessionAttr("oauth2State", "STATE")) .andExpect(redirectedUrl("/signin?error=multiple_users")); }
public void afterPropertiesSet() throws Exception { this.connectSupport = new ConnectSupport(sessionStrategy); this.connectSupport.setUseAuthenticateUrl(true); if (this.applicationUrl != null) { this.connectSupport.setApplicationUrl(applicationUrl); } }
ProviderSignInController implements InitializingBean { public void afterPropertiesSet() throws Exception { this.connectSupport = new ConnectSupport(sessionStrategy); this.connectSupport.setUseAuthenticateUrl(true); if (this.applicationUrl != null) { this.connectSupport.setApplicationUrl(applicationUrl); } } }
ProviderSignInController implements InitializingBean { public void afterPropertiesSet() throws Exception { this.connectSupport = new ConnectSupport(sessionStrategy); this.connectSupport.setUseAuthenticateUrl(true); if (this.applicationUrl != null) { this.connectSupport.setApplicationUrl(applicationUrl); } } @Inject  ProviderSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, SignInAdapter signInAdapter); }
ProviderSignInController implements InitializingBean { public void afterPropertiesSet() throws Exception { this.connectSupport = new ConnectSupport(sessionStrategy); this.connectSupport.setUseAuthenticateUrl(true); if (this.applicationUrl != null) { this.connectSupport.setApplicationUrl(applicationUrl); } } @Inject  ProviderSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, SignInAdapter signInAdapter); void setSignInInterceptors(List<ProviderSignInInterceptor<?>> interceptors); void setSignInUrl(String signInUrl); void setSignUpUrl(String signUpUrl); void setPostSignInUrl(String postSignInUrl); void setApplicationUrl(String applicationUrl); void setSessionStrategy(SessionStrategy sessionStrategy); void addSignInInterceptor(ProviderSignInInterceptor<?> interceptor); @RequestMapping(value="/{providerId}", method=RequestMethod.POST) RedirectView signIn(@PathVariable String providerId, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token") RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="code") RedirectView oauth2Callback(@PathVariable String providerId, @RequestParam("code") String code, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="error") RedirectView oauth2ErrorCallback(@PathVariable String providerId,
			@RequestParam("error") String error,
			@RequestParam(value="error_description", required=false) String errorDescription,
			@RequestParam(value="error_uri", required=false) String errorUri,
			NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET) RedirectView canceledAuthorizationCallback(); void afterPropertiesSet(); }
ProviderSignInController implements InitializingBean { public void afterPropertiesSet() throws Exception { this.connectSupport = new ConnectSupport(sessionStrategy); this.connectSupport.setUseAuthenticateUrl(true); if (this.applicationUrl != null) { this.connectSupport.setApplicationUrl(applicationUrl); } } @Inject  ProviderSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, SignInAdapter signInAdapter); void setSignInInterceptors(List<ProviderSignInInterceptor<?>> interceptors); void setSignInUrl(String signInUrl); void setSignUpUrl(String signUpUrl); void setPostSignInUrl(String postSignInUrl); void setApplicationUrl(String applicationUrl); void setSessionStrategy(SessionStrategy sessionStrategy); void addSignInInterceptor(ProviderSignInInterceptor<?> interceptor); @RequestMapping(value="/{providerId}", method=RequestMethod.POST) RedirectView signIn(@PathVariable String providerId, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token") RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="code") RedirectView oauth2Callback(@PathVariable String providerId, @RequestParam("code") String code, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="error") RedirectView oauth2ErrorCallback(@PathVariable String providerId,
			@RequestParam("error") String error,
			@RequestParam(value="error_description", required=false) String errorDescription,
			@RequestParam(value="error_uri", required=false) String errorUri,
			NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET) RedirectView canceledAuthorizationCallback(); void afterPropertiesSet();  }