Class AbstractClientCredentialsClient
java.lang.Object
io.micronaut.security.oauth2.client.clientcredentials.AbstractClientCredentialsClient
- All Implemented Interfaces:
 ClientCredentialsClient
- Direct Known Subclasses:
 DefaultClientCredentialsClient,DefaultClientCredentialsOpenIdClient
@Internal
public abstract class AbstractClientCredentialsClient
extends Object
implements ClientCredentialsClient
Abstract class to create a Client for client credentials grant.
- Since:
 - 2.2.0
 - Author:
 - Sergio del Amo
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final OauthClientConfigurationprotected final Map<String,org.reactivestreams.Publisher<TokenResponse>> protected final TokenEndpointClient - 
Constructor Summary
ConstructorsConstructorDescriptionAbstractClientCredentialsClient(OauthClientConfiguration oauthClientConfiguration, TokenEndpointClient tokenEndpointClient)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ClientCredentialsTokenRequestContextcreateTokenRequestContext(String scope) expirationDate(TokenResponse tokenResponse) getName()protected booleanisExpired(TokenResponse tokenResponse) protected booleanorg.reactivestreams.Publisher<TokenResponse>requestToken(String scope) org.reactivestreams.Publisher<TokenResponse>requestToken(String scope, boolean force) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.security.oauth2.client.clientcredentials.ClientCredentialsClient
requestToken, requestToken 
- 
Field Details
- 
tokenEndpointClient
 - 
oauthClientConfiguration
 - 
scopeToPublisherMap
 
 - 
 - 
Constructor Details
- 
AbstractClientCredentialsClient
public AbstractClientCredentialsClient(@NonNull OauthClientConfiguration oauthClientConfiguration, @NonNull TokenEndpointClient tokenEndpointClient) - Parameters:
 tokenEndpointClient- The token endpoint clientoauthClientConfiguration- The client configuration
 
 - 
 - 
Method Details
- 
getName
- Returns:
 - the bean's name;
 
 - 
requestToken
- Specified by:
 requestTokenin interfaceClientCredentialsClient- Parameters:
 scope- Requested scope values for the access token.- Returns:
 - Response of an authorization server to a valid client credentials request.
 
 - 
requestToken
@NonNull public org.reactivestreams.Publisher<TokenResponse> requestToken(@Nullable String scope, boolean force) - Specified by:
 requestTokenin interfaceClientCredentialsClient- Parameters:
 scope- Requested scope values for the access token.force- true to invalidate the cached token response and fetch a new one- Returns:
 - Response of an authorization server to a valid client credentials request.
 
 - 
isExpired
- Parameters:
 tokenResponse- Token Response- Returns:
 - true if any A) parameter token response is null B) if an expiration time cannot parsed C) (expiration date - 
ClientCredentialsConfiguration.getAdvancedExpiration()) before current date. 
 - 
isExpired
- Parameters:
 expirationDate- Expiration- Returns:
 - true if the (expiration date - 
ClientCredentialsConfiguration.getAdvancedExpiration()) before current date. 
 - 
expirationDate
- Parameters:
 tokenResponse- Token Response- Returns:
 - The expiration date from the exp claim in the access token is a JWT or the expiration date calculated from the expiresIn
 
 - 
createTokenRequestContext
protected abstract ClientCredentialsTokenRequestContext createTokenRequestContext(@Nullable String scope) - Parameters:
 scope- The requested scope for the client credentials request- Returns:
 - A client credentials token request context
 
 
 -