Class OidcAuthorizedClientRefreshedEventListener
java.lang.Object
org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizedClientRefreshedEventListener
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.ApplicationListener<OAuth2AuthorizedClientRefreshedEvent>
public final class OidcAuthorizedClientRefreshedEventListener
extends Object
implements org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.ApplicationListener<OAuth2AuthorizedClientRefreshedEvent>
An
ApplicationListener that listens for events of type
OAuth2AuthorizedClientRefreshedEvent and publishes an event of type
OidcUserRefreshedEvent in order to refresh an OidcUser.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets theApplicationEventPublisherto be used.voidsetAuthoritiesMapper(org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper) Sets theGrantedAuthoritiesMapperused for mappingOAuth2AuthenticatedPrincipal.getAuthorities()} to a new set of authorities which will be associated to theOAuth2LoginAuthenticationToken.voidsetClockSkew(Duration clockSkew) Sets the maximum acceptable clock skew, which is used when checking theissuedAttime.voidsetJwtDecoderFactory(org.springframework.security.oauth2.jwt.JwtDecoderFactory<ClientRegistration> jwtDecoderFactory) Sets theJwtDecoderFactoryused forOidcIdTokensignature verification.voidsetSecurityContextHolderStrategy(org.springframework.security.core.context.SecurityContextHolderStrategy securityContextHolderStrategy) Sets theSecurityContextHolderStrategyto use.voidsetUserService(OAuth2UserService<OidcUserRequest, org.springframework.security.oauth2.core.oidc.user.OidcUser> userService) Sets theOAuth2UserServiceused for obtaining the user attributes of the End-User from the UserInfo Endpoint.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
OidcAuthorizedClientRefreshedEventListener
public OidcAuthorizedClientRefreshedEventListener()
-
-
Method Details
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<OAuth2AuthorizedClientRefreshedEvent>
-
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(org.springframework.security.core.context.SecurityContextHolderStrategy securityContextHolderStrategy) Sets theSecurityContextHolderStrategyto use. The default action is to use theSecurityContextHolderStrategystored inSecurityContextHolder. -
setJwtDecoderFactory
public void setJwtDecoderFactory(org.springframework.security.oauth2.jwt.JwtDecoderFactory<ClientRegistration> jwtDecoderFactory) Sets theJwtDecoderFactoryused forOidcIdTokensignature verification. The factory returns aJwtDecoderassociated to the providedClientRegistration.- Parameters:
jwtDecoderFactory- theJwtDecoderFactoryused forOidcIdTokensignature verification
-
setUserService
public void setUserService(OAuth2UserService<OidcUserRequest, org.springframework.security.oauth2.core.oidc.user.OidcUser> userService) Sets theOAuth2UserServiceused for obtaining the user attributes of the End-User from the UserInfo Endpoint.- Parameters:
userService- the service used for obtaining the user attributes of the End-User from the UserInfo Endpoint
-
setAuthoritiesMapper
public void setAuthoritiesMapper(org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper) Sets theGrantedAuthoritiesMapperused for mappingOAuth2AuthenticatedPrincipal.getAuthorities()} to a new set of authorities which will be associated to theOAuth2LoginAuthenticationToken.- Parameters:
authoritiesMapper- theGrantedAuthoritiesMapperused for mapping the user's authorities
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets theApplicationEventPublisherto be used.- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware- Parameters:
applicationEventPublisher- event publisher to be used
-
setClockSkew
Sets the maximum acceptable clock skew, which is used when checking theissuedAttime. The default is 60 seconds.- Parameters:
clockSkew- the maximum acceptable clock skew
-