public final class OAuth2AuthorizationConsent
extends java.lang.Object
implements java.io.Serializable
authorities granted to a client by the
resource owner.
When authorizing access for a given client, the resource owner may only grant a subset of the authorities
the client requested. The typical use-case is the authorization_code flow, in which the client
requests a set of scopes. The resource owner then selects which scopes they grant to the client.
| Modifier and Type | Class and Description |
|---|---|
static class |
OAuth2AuthorizationConsent.Builder
A builder for
OAuth2AuthorizationConsent. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static OAuth2AuthorizationConsent.Builder |
from(OAuth2AuthorizationConsent authorizationConsent)
Returns a new
OAuth2AuthorizationConsent.Builder, initialized with the values from the provided OAuth2AuthorizationConsent. |
java.util.Set<org.springframework.security.core.GrantedAuthority> |
getAuthorities()
Returns the
authorities granted to the client by the principal. |
java.lang.String |
getPrincipalName()
Returns the
Principal name of the resource owner (or client). |
java.lang.String |
getRegisteredClientId()
Returns the identifier for the
registered client. |
java.util.Set<java.lang.String> |
getScopes()
Convenience method for obtaining the
scopes granted to the client by the principal,
extracted from the authorities. |
int |
hashCode() |
static OAuth2AuthorizationConsent.Builder |
withId(java.lang.String registeredClientId,
java.lang.String principalName)
Returns a new
OAuth2AuthorizationConsent.Builder, initialized with the given registeredClientId
and Principal name. |
public java.lang.String getRegisteredClientId()
registered client.RegisteredClient.getId()public java.lang.String getPrincipalName()
Principal name of the resource owner (or client).Principal name of the resource owner (or client)public java.util.Set<org.springframework.security.core.GrantedAuthority> getAuthorities()
authorities granted to the client by the principal.authorities granted to the client by the principal.public java.util.Set<java.lang.String> getScopes()
scopes granted to the client by the principal,
extracted from the authorities.scopes granted to the client by the principal.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static OAuth2AuthorizationConsent.Builder from(OAuth2AuthorizationConsent authorizationConsent)
OAuth2AuthorizationConsent.Builder, initialized with the values from the provided OAuth2AuthorizationConsent.authorizationConsent - the OAuth2AuthorizationConsent used for initializing the OAuth2AuthorizationConsent.BuilderOAuth2AuthorizationConsent.Builderpublic static OAuth2AuthorizationConsent.Builder withId(@NonNull java.lang.String registeredClientId, @NonNull java.lang.String principalName)
OAuth2AuthorizationConsent.Builder, initialized with the given registeredClientId
and Principal name.registeredClientId - the RegisteredClient.getId()principalName - the Principal nameOAuth2AuthorizationConsent.Builder