Class OAuth2AuthorizationContext.Builder
java.lang.Object
org.springframework.security.oauth2.client.OAuth2AuthorizationContext.Builder
- Enclosing class:
- OAuth2AuthorizationContext
A builder for
OAuth2AuthorizationContext
.-
Method Summary
Modifier and TypeMethodDescriptionSets an attribute associated to the context.attributes
(Consumer<Map<String, Object>> attributesConsumer) Provides aConsumer
access to the attributes associated to the context.build()
Builds a newOAuth2AuthorizationContext
.principal
(Authentication principal) Sets thePrincipal
(to be) associated to the authorized client.
-
Method Details
-
principal
Sets thePrincipal
(to be) associated to the authorized client.- Parameters:
principal
- thePrincipal
(to be) associated to the authorized client- Returns:
- the
OAuth2AuthorizationContext.Builder
-
attributes
public OAuth2AuthorizationContext.Builder attributes(Consumer<Map<String, Object>> attributesConsumer) Provides aConsumer
access to the attributes associated to the context.- Parameters:
attributesConsumer
- aConsumer
of the attributes associated to the context- Returns:
- the
OAuth2AuthorizeRequest.Builder
-
attribute
Sets an attribute associated to the context.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the
OAuth2AuthorizationContext.Builder
-
build
Builds a newOAuth2AuthorizationContext
.- Returns:
- a
OAuth2AuthorizationContext
-