Class ServiceTokens
java.lang.Object
com.irurueta.authserver.serviceclient.infrastructure.resourceserver.ServiceTokens
Gives the access token the service client uses, for the CLI that is asked to print it. It goes through the same
authorized client manager as the calls, so the token is the cached one while it is valid and no extra request is
made.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManagerObtains and renews the access tokens.private final PrincipalMapperBuilds the principals the tokens are cached under.private final ServiceClientAuthPropertiesSettings of the service client. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGives the access token of the client credentials grant.exchangedToken(String subjectToken) Gives the access token the authorization server issues for the client acting on behalf of a user.private StringObtains a token.
-
Field Details
-
manager
private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager managerObtains and renews the access tokens. -
principalMapper
Builds the principals the tokens are cached under. -
properties
Settings of the service client.
-
-
Constructor Details
-
ServiceTokens
public ServiceTokens()
-
-
Method Details
-
clientCredentialsToken
Gives the access token of the client credentials grant.- Returns:
- the token value.
- Throws:
DocumentAccessException- if the token cannot be obtained.
-
exchangedToken
Gives the access token the authorization server issues for the client acting on behalf of a user.- Parameters:
subjectToken- access token of the user.- Returns:
- the exchanged token value.
- Throws:
DocumentAccessException- if the exchange fails.
-
token
private String token(String registrationId, org.springframework.security.core.Authentication principal) Obtains a token.- Parameters:
registrationId- registration of the OAuth2 client.principal- principal the token is cached under.- Returns:
- the token value.
-