public final class OAuth2AuthorizationContext
extends java.lang.Object
OAuth2AuthorizedClientProvider
when attempting to authorize (or re-authorize)
an OAuth 2.0 Client.OAuth2AuthorizedClientProvider
Modifier and Type | Class and Description |
---|---|
static class |
OAuth2AuthorizationContext.Builder
A builder for
OAuth2AuthorizationContext . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PASSWORD_ATTRIBUTE_NAME
The name of the
attribute in the context associated
to the value for the resource owner's password. |
static java.lang.String |
REQUEST_SCOPE_ATTRIBUTE_NAME
The name of the
attribute in the context associated
to the value for the "request scope(s)". |
static java.lang.String |
USERNAME_ATTRIBUTE_NAME
The name of the
attribute in the context associated
to the value for the resource owner's username. |
Modifier and Type | Method and Description |
---|---|
<T> T |
getAttribute(java.lang.String name)
Returns the value of an attribute associated to the context or
null if not
available. |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Returns the attributes associated to the context.
|
OAuth2AuthorizedClient |
getAuthorizedClient()
|
ClientRegistration |
getClientRegistration()
Returns the
client registration . |
Authentication |
getPrincipal()
Returns the
Principal (to be) associated to the authorized client. |
static OAuth2AuthorizationContext.Builder |
withAuthorizedClient(OAuth2AuthorizedClient authorizedClient)
Returns a new
OAuth2AuthorizationContext.Builder initialized with the OAuth2AuthorizedClient . |
static OAuth2AuthorizationContext.Builder |
withClientRegistration(ClientRegistration clientRegistration)
Returns a new
OAuth2AuthorizationContext.Builder initialized with the ClientRegistration . |
public static final java.lang.String REQUEST_SCOPE_ATTRIBUTE_NAME
public static final java.lang.String USERNAME_ATTRIBUTE_NAME
attribute
in the context associated
to the value for the resource owner's username.public static final java.lang.String PASSWORD_ATTRIBUTE_NAME
attribute
in the context associated
to the value for the resource owner's password.public ClientRegistration getClientRegistration()
client registration
.ClientRegistration
@Nullable public OAuth2AuthorizedClient getAuthorizedClient()
OAuth2AuthorizedClient
or null
if the client
registration was suppliedpublic Authentication getPrincipal()
Principal
(to be) associated to the authorized client.Principal
(to be) associated to the authorized clientpublic java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Map
of the attributes associated to the context@Nullable public <T> T getAttribute(java.lang.String name)
null
if not
available.T
- the type of the attributename
- the name of the attributepublic static OAuth2AuthorizationContext.Builder withClientRegistration(ClientRegistration clientRegistration)
OAuth2AuthorizationContext.Builder
initialized with the ClientRegistration
.clientRegistration
- the client registration
OAuth2AuthorizationContext.Builder
public static OAuth2AuthorizationContext.Builder withAuthorizedClient(OAuth2AuthorizedClient authorizedClient)
OAuth2AuthorizationContext.Builder
initialized with the OAuth2AuthorizedClient
.authorizedClient
- the authorized client
OAuth2AuthorizationContext.Builder