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) AConsumerof theauthorities, allowing the ability to add, replace or remove.authority(org.springframework.security.core.GrantedAuthority authority) Adds aGrantedAuthorityto the collection ofauthoritiesin the resultingOAuth2AuthorizationConsent.build()Validate the authorities and build theOAuth2AuthorizationConsent.Adds a scope to the collection ofauthoritiesin the resultingOAuth2AuthorizationConsent, wrapping it in aSimpleGrantedAuthority, prefixed bySCOPE_.
-
Method Details
-
scope
Adds a scope to the collection ofauthoritiesin the resultingOAuth2AuthorizationConsent, wrapping it in aSimpleGrantedAuthority, prefixed bySCOPE_. For example, amessage.writescope would be stored asSCOPE_message.write.- Parameters:
scope- the scope- Returns:
- the
Builderfor further configuration
-
authority
public OAuth2AuthorizationConsent.Builder authority(org.springframework.security.core.GrantedAuthority authority) Adds aGrantedAuthorityto the collection ofauthoritiesin the resultingOAuth2AuthorizationConsent.- Parameters:
authority- theGrantedAuthority- Returns:
- the
Builderfor further configuration
-
authorities
public OAuth2AuthorizationConsent.Builder authorities(Consumer<Set<org.springframework.security.core.GrantedAuthority>> authoritiesConsumer) AConsumerof theauthorities, allowing the ability to add, replace or remove.- Parameters:
authoritiesConsumer- aConsumerof theauthorities- Returns:
- the
Builderfor further configuration
-
build
Validate the authorities and build theOAuth2AuthorizationConsent. There must be at least oneGrantedAuthority.- Returns:
- the
OAuth2AuthorizationConsent
-