Class OAuth2Authorization.Builder
java.lang.Object
org.springframework.security.oauth2.server.authorization.OAuth2Authorization.Builder
- All Implemented Interfaces:
Serializable
- Enclosing class:
- OAuth2Authorization
A builder for
OAuth2Authorization
.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccessToken
(org.springframework.security.oauth2.core.OAuth2AccessToken accessToken) Sets theaccess token
.Adds an attribute associated to the authorization.attributes
(Consumer<Map<String, Object>> attributesConsumer) AConsumer
of the attributesMap
allowing the ability to add, replace, or remove.authorizationGrantType
(org.springframework.security.oauth2.core.AuthorizationGrantType authorizationGrantType) Sets theauthorization grant type
used for the authorization.authorizedScopes
(Set<String> authorizedScopes) Sets the authorized scope(s).build()
Builds a newOAuth2Authorization
.Sets the identifier for the authorization.principalName
(String principalName) Sets thePrincipal
name of the resource owner (or client).refreshToken
(org.springframework.security.oauth2.core.OAuth2RefreshToken refreshToken) Sets therefresh token
.<T extends org.springframework.security.oauth2.core.OAuth2Token>
OAuth2Authorization.Buildertoken
(T token) Sets thetoken
.<T extends org.springframework.security.oauth2.core.OAuth2Token>
OAuth2Authorization.BuilderSets thetoken
and associated metadata.protected final OAuth2Authorization.Builder
tokens
(Map<Class<? extends org.springframework.security.oauth2.core.OAuth2Token>, OAuth2Authorization.Token<?>> tokens)
-
Constructor Details
-
Builder
-
-
Method Details
-
id
Sets the identifier for the authorization.- Parameters:
id
- the identifier for the authorization- Returns:
- the
OAuth2Authorization.Builder
-
principalName
Sets thePrincipal
name of the resource owner (or client).- Parameters:
principalName
- thePrincipal
name of the resource owner (or client)- Returns:
- the
OAuth2Authorization.Builder
-
authorizationGrantType
public OAuth2Authorization.Builder authorizationGrantType(org.springframework.security.oauth2.core.AuthorizationGrantType authorizationGrantType) Sets theauthorization grant type
used for the authorization.- Parameters:
authorizationGrantType
- theAuthorizationGrantType
- Returns:
- the
OAuth2Authorization.Builder
-
authorizedScopes
Sets the authorized scope(s).- Parameters:
authorizedScopes
- theSet
of authorized scope(s)- Returns:
- the
OAuth2Authorization.Builder
- Since:
- 0.4.0
-
accessToken
public OAuth2Authorization.Builder accessToken(org.springframework.security.oauth2.core.OAuth2AccessToken accessToken) Sets theaccess token
.- Parameters:
accessToken
- theOAuth2AccessToken
- Returns:
- the
OAuth2Authorization.Builder
-
refreshToken
public OAuth2Authorization.Builder refreshToken(org.springframework.security.oauth2.core.OAuth2RefreshToken refreshToken) Sets therefresh token
.- Parameters:
refreshToken
- theOAuth2RefreshToken
- Returns:
- the
OAuth2Authorization.Builder
-
token
public <T extends org.springframework.security.oauth2.core.OAuth2Token> OAuth2Authorization.Builder token(T token) Sets thetoken
.- Type Parameters:
T
- the type of the token- Parameters:
token
- the token- Returns:
- the
OAuth2Authorization.Builder
-
token
public <T extends org.springframework.security.oauth2.core.OAuth2Token> OAuth2Authorization.Builder token(T token, Consumer<Map<String, Object>> metadataConsumer) Sets thetoken
and associated metadata.- Type Parameters:
T
- the type of the token- Parameters:
token
- the tokenmetadataConsumer
- aConsumer
of the metadataMap
- Returns:
- the
OAuth2Authorization.Builder
-
tokens
protected final OAuth2Authorization.Builder tokens(Map<Class<? extends org.springframework.security.oauth2.core.OAuth2Token>, OAuth2Authorization.Token<?>> tokens) -
attribute
Adds an attribute associated to the authorization.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the
OAuth2Authorization.Builder
-
attributes
AConsumer
of the attributesMap
allowing the ability to add, replace, or remove.- Parameters:
attributesConsumer
- aConsumer
of the attributesMap
- Returns:
- the
OAuth2Authorization.Builder
-
build
Builds a newOAuth2Authorization
.- Returns:
- the
OAuth2Authorization
-