Class OAuth2AuthorizationConsent
java.lang.Object
org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsent
- All Implemented Interfaces:
Serializable
A representation of an OAuth 2.0 "consent" to an Authorization request, which holds
state related to the set of
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.
- Since:
- 0.1.2
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleanfrom(OAuth2AuthorizationConsent authorizationConsent) Returns a newOAuth2AuthorizationConsent.Builder, initialized with the values from the providedOAuth2AuthorizationConsent.Set<org.springframework.security.core.GrantedAuthority>Returns theauthoritiesgranted to the client by the principal.Returns thePrincipalname of the resource owner (or client).Returns the identifier for theregistered client.Convenience method for obtaining thescopes granted to the client by the principal, extracted from theauthorities.inthashCode()Returns a newOAuth2AuthorizationConsent.Builder, initialized with the givenregisteredClientIdandPrincipalname.
-
Method Details
-
getRegisteredClientId
Returns the identifier for theregistered client.- Returns:
- the
RegisteredClient.getId()
-
getPrincipalName
Returns thePrincipalname of the resource owner (or client).- Returns:
- the
Principalname of the resource owner (or client)
-
getAuthorities
Returns theauthoritiesgranted to the client by the principal.- Returns:
- the
authoritiesgranted to the client by the principal.
-
getScopes
Convenience method for obtaining thescopes granted to the client by the principal, extracted from theauthorities.- Returns:
- the
scopes granted to the client by the principal.
-
equals
-
hashCode
public int hashCode() -
from
public static OAuth2AuthorizationConsent.Builder from(OAuth2AuthorizationConsent authorizationConsent) Returns a newOAuth2AuthorizationConsent.Builder, initialized with the values from the providedOAuth2AuthorizationConsent.- Parameters:
authorizationConsent- theOAuth2AuthorizationConsentused for initializing theOAuth2AuthorizationConsent.Builder- Returns:
- the
OAuth2AuthorizationConsent.Builder
-
withId
public static OAuth2AuthorizationConsent.Builder withId(@NonNull String registeredClientId, @NonNull String principalName) Returns a newOAuth2AuthorizationConsent.Builder, initialized with the givenregisteredClientIdandPrincipalname.- Parameters:
registeredClientId- theRegisteredClient.getId()principalName- thePrincipalname- Returns:
- the
OAuth2AuthorizationConsent.Builder
-