Class OAuth2AuthorizedClient
- java.lang.Object
-
- org.springframework.security.oauth2.client.OAuth2AuthorizedClient
-
- All Implemented Interfaces:
java.io.Serializable
public class OAuth2AuthorizedClient extends java.lang.Object implements java.io.SerializableA 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 it's protected resources.
This class associates the
Clientto theAccess Tokengranted/authorized by theResource Owner.- Since:
- 5.0
- See Also:
ClientRegistration,OAuth2AccessToken,OAuth2RefreshToken, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OAuth2AuthorizedClient(ClientRegistration clientRegistration, java.lang.String principalName, OAuth2AccessToken accessToken)Constructs anOAuth2AuthorizedClientusing the provided parameters.OAuth2AuthorizedClient(ClientRegistration clientRegistration, java.lang.String principalName, OAuth2AccessToken accessToken, OAuth2RefreshToken refreshToken)Constructs anOAuth2AuthorizedClientusing the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuth2AccessTokengetAccessToken()Returns theaccess tokencredential granted.ClientRegistrationgetClientRegistration()Returns the authorized client'sregistration.java.lang.StringgetPrincipalName()Returns the End-User'sPrincipalname.OAuth2RefreshTokengetRefreshToken()Returns therefresh tokencredential granted.
-
-
-
Constructor Detail
-
OAuth2AuthorizedClient
public OAuth2AuthorizedClient(ClientRegistration clientRegistration, java.lang.String principalName, OAuth2AccessToken accessToken)
Constructs anOAuth2AuthorizedClientusing the provided parameters.- Parameters:
clientRegistration- the authorized client's registrationprincipalName- the name of the End-UserPrincipal(Resource Owner)accessToken- the access token credential granted
-
OAuth2AuthorizedClient
public OAuth2AuthorizedClient(ClientRegistration clientRegistration, java.lang.String principalName, OAuth2AccessToken accessToken, @Nullable OAuth2RefreshToken refreshToken)
Constructs anOAuth2AuthorizedClientusing the provided parameters.- Parameters:
clientRegistration- the authorized client's registrationprincipalName- the name of the End-UserPrincipal(Resource Owner)accessToken- the access token credential grantedrefreshToken- the refresh token credential granted
-
-
Method Detail
-
getClientRegistration
public ClientRegistration getClientRegistration()
Returns the authorized client'sregistration.- Returns:
- the
ClientRegistration
-
getPrincipalName
public java.lang.String getPrincipalName()
Returns the End-User'sPrincipalname.- Returns:
- the End-User's
Principalname
-
getAccessToken
public OAuth2AccessToken getAccessToken()
Returns theaccess tokencredential granted.- Returns:
- the
OAuth2AccessToken
-
getRefreshToken
@Nullable public OAuth2RefreshToken getRefreshToken()
Returns therefresh tokencredential granted.- Returns:
- the
OAuth2RefreshToken - Since:
- 5.1
-
-