|
|
|
@ -87,6 +87,7 @@ import org.springframework.security.web.authentication.LoginUrlAuthenticationEnt |
|
|
|
import org.springframework.security.web.authentication.session.SessionAuthenticationException; |
|
|
|
import org.springframework.security.web.authentication.session.SessionAuthenticationException; |
|
|
|
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; |
|
|
|
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; |
|
|
|
import org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter; |
|
|
|
import org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter; |
|
|
|
|
|
|
|
import org.springframework.security.web.context.SecurityContextRepository; |
|
|
|
import org.springframework.security.web.csrf.CsrfToken; |
|
|
|
import org.springframework.security.web.csrf.CsrfToken; |
|
|
|
import org.springframework.security.web.savedrequest.RequestCache; |
|
|
|
import org.springframework.security.web.savedrequest.RequestCache; |
|
|
|
import org.springframework.security.web.util.matcher.AndRequestMatcher; |
|
|
|
import org.springframework.security.web.util.matcher.AndRequestMatcher; |
|
|
|
@ -177,6 +178,8 @@ public final class OAuth2LoginConfigurer<B extends HttpSecurityBuilder<B>> |
|
|
|
|
|
|
|
|
|
|
|
private OAuth2AuthorizedClientRepository authorizedClientRepository; |
|
|
|
private OAuth2AuthorizedClientRepository authorizedClientRepository; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SecurityContextRepository securityContextRepository; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets the repository of client registrations. |
|
|
|
* Sets the repository of client registrations. |
|
|
|
* @param clientRegistrationRepository the repository of client registrations |
|
|
|
* @param clientRegistrationRepository the repository of client registrations |
|
|
|
@ -230,6 +233,17 @@ public final class OAuth2LoginConfigurer<B extends HttpSecurityBuilder<B>> |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the {@link SecurityContextRepository} to use. |
|
|
|
|
|
|
|
* @param securityContextRepository the {@link SecurityContextRepository} to use |
|
|
|
|
|
|
|
* @return the {@link OAuth2LoginConfigurer} for further configuration |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public OAuth2LoginConfigurer<B> securityContextRepository(SecurityContextRepository securityContextRepository) { |
|
|
|
|
|
|
|
this.securityContextRepository = securityContextRepository; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets the registry for managing the OIDC client-provider session link |
|
|
|
* Sets the registry for managing the OIDC client-provider session link |
|
|
|
* @param oidcSessionRegistry the {@link OidcSessionRegistry} to use |
|
|
|
* @param oidcSessionRegistry the {@link OidcSessionRegistry} to use |
|
|
|
@ -348,6 +362,9 @@ public final class OAuth2LoginConfigurer<B extends HttpSecurityBuilder<B>> |
|
|
|
OAuth2LoginAuthenticationFilter authenticationFilter = new OAuth2LoginAuthenticationFilter( |
|
|
|
OAuth2LoginAuthenticationFilter authenticationFilter = new OAuth2LoginAuthenticationFilter( |
|
|
|
this.getClientRegistrationRepository(), this.getAuthorizedClientRepository(), this.loginProcessingUrl); |
|
|
|
this.getClientRegistrationRepository(), this.getAuthorizedClientRepository(), this.loginProcessingUrl); |
|
|
|
authenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy()); |
|
|
|
authenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy()); |
|
|
|
|
|
|
|
if (this.securityContextRepository != null) { |
|
|
|
|
|
|
|
authenticationFilter.setSecurityContextRepository(this.securityContextRepository); |
|
|
|
|
|
|
|
} |
|
|
|
this.setAuthenticationFilter(authenticationFilter); |
|
|
|
this.setAuthenticationFilter(authenticationFilter); |
|
|
|
super.loginProcessingUrl(this.loginProcessingUrl); |
|
|
|
super.loginProcessingUrl(this.loginProcessingUrl); |
|
|
|
if (this.loginPage != null) { |
|
|
|
if (this.loginPage != null) { |
|
|
|
|