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.
Since:
6.5
See Also:
  • Constructor Details

    • OidcAuthorizedClientRefreshedEventListener

      public OidcAuthorizedClientRefreshedEventListener()
  • Method Details

    • onApplicationEvent

      public void onApplicationEvent(OAuth2AuthorizedClientRefreshedEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<OAuth2AuthorizedClientRefreshedEvent>
    • setSecurityContextHolderStrategy

      public void setSecurityContextHolderStrategy(org.springframework.security.core.context.SecurityContextHolderStrategy securityContextHolderStrategy)
      Sets the SecurityContextHolderStrategy to use. The default action is to use the SecurityContextHolderStrategy stored in SecurityContextHolder.
    • setJwtDecoderFactory

      public void setJwtDecoderFactory(org.springframework.security.oauth2.jwt.JwtDecoderFactory<ClientRegistration> jwtDecoderFactory)
      Sets the JwtDecoderFactory used for OidcIdToken signature verification. The factory returns a JwtDecoder associated to the provided ClientRegistration.
      Parameters:
      jwtDecoderFactory - the JwtDecoderFactory used for OidcIdToken signature verification
    • setUserService

      public void setUserService(OAuth2UserService<OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser> userService)
      Sets the OAuth2UserService 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

      public void setAuthoritiesMapper(org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper)
      Sets the GrantedAuthoritiesMapper used for mapping OAuth2AuthenticatedPrincipal.getAuthorities()} to a new set of authorities which will be associated to the OAuth2LoginAuthenticationToken.
      Parameters:
      authoritiesMapper - the GrantedAuthoritiesMapper used for mapping the user's authorities
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Sets the ApplicationEventPublisher to be used.
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
      Parameters:
      applicationEventPublisher - event publisher to be used
    • setClockSkew

      public void setClockSkew(Duration clockSkew)
      Sets the maximum acceptable clock skew, which is used when checking the issuedAt time. The default is 60 seconds.
      Parameters:
      clockSkew - the maximum acceptable clock skew