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 TypeMethodDescriptionvoid
void
setApplicationEventPublisher
(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets theApplicationEventPublisher
to be used.void
setAuthoritiesMapper
(GrantedAuthoritiesMapper authoritiesMapper) Sets theGrantedAuthoritiesMapper
used for mappingOAuth2AuthenticatedPrincipal.getAuthorities()
} to a new set of authorities which will be associated to theOAuth2LoginAuthenticationToken
.void
setClockSkew
(Duration clockSkew) Sets the maximum acceptable clock skew, which is used when checking theissuedAt
time.void
setJwtDecoderFactory
(JwtDecoderFactory<ClientRegistration> jwtDecoderFactory) Sets theJwtDecoderFactory
used forOidcIdToken
signature verification.void
setSecurityContextHolderStrategy
(SecurityContextHolderStrategy securityContextHolderStrategy) Sets theSecurityContextHolderStrategy
to use.void
setUserService
(OAuth2UserService<OidcUserRequest, OidcUser> userService) Sets theOAuth2UserService
used 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, wait
Methods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
OidcAuthorizedClientRefreshedEventListener
public OidcAuthorizedClientRefreshedEventListener()
-
-
Method Details
-
onApplicationEvent
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<OAuth2AuthorizedClientRefreshedEvent>
-
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) Sets theSecurityContextHolderStrategy
to use. The default action is to use theSecurityContextHolderStrategy
stored inSecurityContextHolder
. -
setJwtDecoderFactory
Sets theJwtDecoderFactory
used forOidcIdToken
signature verification. The factory returns aJwtDecoder
associated to the providedClientRegistration
.- Parameters:
jwtDecoderFactory
- theJwtDecoderFactory
used forOidcIdToken
signature verification
-
setUserService
Sets theOAuth2UserService
used 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
Sets theGrantedAuthoritiesMapper
used for mappingOAuth2AuthenticatedPrincipal.getAuthorities()
} to a new set of authorities which will be associated to theOAuth2LoginAuthenticationToken
.- Parameters:
authoritiesMapper
- theGrantedAuthoritiesMapper
used for mapping the user's authorities
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Sets theApplicationEventPublisher
to be used.- Specified by:
setApplicationEventPublisher
in interfaceorg.springframework.context.ApplicationEventPublisherAware
- Parameters:
applicationEventPublisher
- event publisher to be used
-
setClockSkew
Sets the maximum acceptable clock skew, which is used when checking theissuedAt
time. The default is 60 seconds.- Parameters:
clockSkew
- the maximum acceptable clock skew
-