Class OAuth2AuthorizationConsent.Builder
java.lang.Object
org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsent.Builder
- All Implemented Interfaces:
Serializable
- Enclosing class:
- OAuth2AuthorizationConsent
A builder for
OAuth2AuthorizationConsent
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionauthorities
(Consumer<Set<org.springframework.security.core.GrantedAuthority>> authoritiesConsumer) AConsumer
of theauthorities
, allowing the ability to add, replace or remove.authority
(org.springframework.security.core.GrantedAuthority authority) Adds aGrantedAuthority
to the collection ofauthorities
in the resultingOAuth2AuthorizationConsent
.build()
Validate the authorities and build theOAuth2AuthorizationConsent
.Adds a scope to the collection ofauthorities
in the resultingOAuth2AuthorizationConsent
, wrapping it in aSimpleGrantedAuthority
, prefixed bySCOPE_
.
-
Method Details
-
scope
Adds a scope to the collection ofauthorities
in the resultingOAuth2AuthorizationConsent
, wrapping it in aSimpleGrantedAuthority
, prefixed bySCOPE_
. For example, amessage.write
scope would be stored asSCOPE_message.write
.- Parameters:
scope
- the scope- Returns:
- the
Builder
for further configuration
-
authority
public OAuth2AuthorizationConsent.Builder authority(org.springframework.security.core.GrantedAuthority authority) Adds aGrantedAuthority
to the collection ofauthorities
in the resultingOAuth2AuthorizationConsent
.- Parameters:
authority
- theGrantedAuthority
- Returns:
- the
Builder
for further configuration
-
authorities
public OAuth2AuthorizationConsent.Builder authorities(Consumer<Set<org.springframework.security.core.GrantedAuthority>> authoritiesConsumer) AConsumer
of theauthorities
, allowing the ability to add, replace or remove.- Parameters:
authoritiesConsumer
- aConsumer
of theauthorities
- Returns:
- the
Builder
for further configuration
-
build
Validate the authorities and build theOAuth2AuthorizationConsent
. There must be at least oneGrantedAuthority
.- Returns:
- the
OAuth2AuthorizationConsent
-