Class OAuth2AuthorizationContext.Builder
- java.lang.Object
-
- org.springframework.security.oauth2.client.OAuth2AuthorizationContext.Builder
-
- Enclosing class:
- OAuth2AuthorizationContext
public static final class OAuth2AuthorizationContext.Builder extends java.lang.Object
A builder forOAuth2AuthorizationContext
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuth2AuthorizationContext.Builder
attribute(java.lang.String name, java.lang.Object value)
Sets an attribute associated to the context.OAuth2AuthorizationContext.Builder
attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
Provides aConsumer
access to the attributes associated to the context.OAuth2AuthorizationContext
build()
Builds a newOAuth2AuthorizationContext
.OAuth2AuthorizationContext.Builder
principal(Authentication principal)
Sets thePrincipal
(to be) associated to the authorized client.
-
-
-
Method Detail
-
principal
public OAuth2AuthorizationContext.Builder principal(Authentication 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(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.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
public OAuth2AuthorizationContext.Builder attribute(java.lang.String name, java.lang.Object value)
Sets an attribute associated to the context.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the
OAuth2AuthorizationContext.Builder
-
build
public OAuth2AuthorizationContext build()
Builds a newOAuth2AuthorizationContext
.- Returns:
- a
OAuth2AuthorizationContext
-
-