Class OAuth2AuthorizedClient
java.lang.Object
org.springframework.security.oauth2.client.OAuth2AuthorizedClient
- All Implemented Interfaces:
- Serializable
A representation of an OAuth 2.0 "Authorized Client".
 
A client is considered "authorized" when the End-User (Resource Owner) has granted authorization to the client to access its protected resources.
 This class associates the Client to the
 Access Token granted/authorized by the
 Resource Owner.
- Since:
- 5.0
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionOAuth2AuthorizedClient(ClientRegistration clientRegistration, String principalName, OAuth2AccessToken accessToken) Constructs anOAuth2AuthorizedClientusing the provided parameters.OAuth2AuthorizedClient(ClientRegistration clientRegistration, String principalName, OAuth2AccessToken accessToken, OAuth2RefreshToken refreshToken) Constructs anOAuth2AuthorizedClientusing the provided parameters.
- 
Method SummaryModifier and TypeMethodDescriptionReturns theaccess tokencredential granted.Returns the authorized client'sregistration.Returns the End-User'sPrincipalname.Returns therefresh tokencredential granted.
- 
Constructor Details- 
OAuth2AuthorizedClientpublic OAuth2AuthorizedClient(ClientRegistration clientRegistration, String principalName, OAuth2AccessToken accessToken) Constructs anOAuth2AuthorizedClientusing the provided parameters.- Parameters:
- clientRegistration- the authorized client's registration
- principalName- the name of the End-User- Principal(Resource Owner)
- accessToken- the access token credential granted
 
- 
OAuth2AuthorizedClientpublic OAuth2AuthorizedClient(ClientRegistration clientRegistration, String principalName, OAuth2AccessToken accessToken, @Nullable OAuth2RefreshToken refreshToken) Constructs anOAuth2AuthorizedClientusing the provided parameters.- Parameters:
- clientRegistration- the authorized client's registration
- principalName- the name of the End-User- Principal(Resource Owner)
- accessToken- the access token credential granted
- refreshToken- the refresh token credential granted
 
 
- 
- 
Method Details- 
getClientRegistrationReturns the authorized client'sregistration.- Returns:
- the ClientRegistration
 
- 
getPrincipalNameReturns the End-User'sPrincipalname.- Returns:
- the End-User's Principalname
 
- 
getAccessTokenReturns theaccess tokencredential granted.- Returns:
- the OAuth2AccessToken
 
- 
getRefreshTokenReturns therefresh tokencredential granted.- Returns:
- the OAuth2RefreshToken
- Since:
- 5.1
 
 
-