Class Oauth2SecurityConfiguration


  • public abstract class Oauth2SecurityConfiguration
    extends java.lang.Object
    This is where to get the OAuth2 ClientRegistrationRepository.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.security.oauth2.client.OAuth2AuthorizedClientService authorizedClientService()  
      protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository()
      Returns a new ClientRegistrationRepository based on the clients defined by the "security.oauth2.client.registration.clients" property.
      java.lang.String getAccessToken​(javax.servlet.http.HttpServletRequest request)  
      protected org.springframework.security.oauth2.client.registration.ClientRegistration getCustomClientRegistration​(java.lang.String client, java.lang.String clientId, java.lang.String clientSecret, java.lang.String[] clientScopes)  
      java.lang.String getPrefixedSessionBearerToken()
      Returns the bearer token with "Bearer " prefixed.
      java.lang.String getPrincipalId()
      Returns the principal ID of the user.
      java.lang.String getSessionBearerToken()
      Returns the session bearer token, if it exists, null otherwise.
      protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository newClientRegistrationRepository​(java.util.List<org.springframework.security.oauth2.client.registration.ClientRegistration> registrations)
      Returns a new instance of ClientRegistrationRepository; defaults to InMemoryClientRegistrationRepository
      protected org.springframework.security.oauth2.client.OAuth2AuthorizedClientService newOAuth2AuthorizedClientService​(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
      Returns a new instance of OAuth2AuthorizedClientService; defaults to InMemoryOAuth2AuthorizedClientService.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Oauth2SecurityConfiguration

        protected Oauth2SecurityConfiguration()
      • Oauth2SecurityConfiguration

        public Oauth2SecurityConfiguration​(org.springframework.core.env.Environment env)
        For unit testing.
        Parameters:
        env -
    • Method Detail

      • authorizedClientService

        @Bean
        protected org.springframework.security.oauth2.client.OAuth2AuthorizedClientService authorizedClientService()
        Returns:
      • clientRegistrationRepository

        @Bean
        protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository()
        Returns a new ClientRegistrationRepository based on the clients defined by the "security.oauth2.client.registration.clients" property.
        Returns:
        a new ClientRegistrationRepository based on the clients defined by the "security.oauth2.client.registration.clients" property
      • getAccessToken

        public java.lang.String getAccessToken​(javax.servlet.http.HttpServletRequest request)
        Returns:
      • getCustomClientRegistration

        protected org.springframework.security.oauth2.client.registration.ClientRegistration getCustomClientRegistration​(java.lang.String client,
                                                                                                                         java.lang.String clientId,
                                                                                                                         java.lang.String clientSecret,
                                                                                                                         java.lang.String[] clientScopes)
        Parameters:
        client -
        Returns:
      • getPrincipalId

        public java.lang.String getPrincipalId()
        Returns the principal ID of the user.
        Returns:
        the principal ID of the user
      • getPrefixedSessionBearerToken

        public java.lang.String getPrefixedSessionBearerToken()
        Returns the bearer token with "Bearer " prefixed.
        Returns:
        the bearer token with "Bearer " prefixed
      • getSessionBearerToken

        public java.lang.String getSessionBearerToken()
        Returns the session bearer token, if it exists, null otherwise.
        Returns:
        the session bearer token, if it exists, null otherwise
      • newClientRegistrationRepository

        protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository newClientRegistrationRepository​(java.util.List<org.springframework.security.oauth2.client.registration.ClientRegistration> registrations)
        Returns a new instance of ClientRegistrationRepository; defaults to InMemoryClientRegistrationRepository
        Parameters:
        registrations -
        Returns:
        a new instance of ClientRegistrationRepository; defaults to InMemoryClientRegistrationRepository
      • newOAuth2AuthorizedClientService

        protected org.springframework.security.oauth2.client.OAuth2AuthorizedClientService newOAuth2AuthorizedClientService​(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
        Returns a new instance of OAuth2AuthorizedClientService; defaults to InMemoryOAuth2AuthorizedClientService.
        Parameters:
        clientRegistrationRepository -
        Returns:
        a new instance of OAuth2AuthorizedClientService; defaults to InMemoryOAuth2AuthorizedClientService