@Internal public abstract class AbstractClientCredentialsClient extends java.lang.Object implements ClientCredentialsClient
Modifier and Type | Field and Description |
---|---|
protected OauthClientConfiguration |
oauthClientConfiguration |
protected java.util.Map<java.lang.String,org.reactivestreams.Publisher<TokenResponse>> |
scopeToPublisherMap |
protected TokenEndpointClient |
tokenEndpointClient |
Constructor and Description |
---|
AbstractClientCredentialsClient(OauthClientConfiguration oauthClientConfiguration,
TokenEndpointClient tokenEndpointClient) |
Modifier and Type | Method and Description |
---|---|
protected abstract ClientCredentialsTokenRequestContext |
createTokenRequestContext(java.lang.String scope) |
protected java.util.Optional<java.util.Date> |
expirationDate(TokenResponse tokenResponse) |
java.lang.String |
getName() |
protected boolean |
isExpired(java.util.Date expirationDate) |
protected boolean |
isExpired(TokenResponse tokenResponse) |
org.reactivestreams.Publisher<TokenResponse> |
requestToken(java.lang.String scope) |
org.reactivestreams.Publisher<TokenResponse> |
requestToken(java.lang.String scope,
boolean force) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
requestToken, requestToken
protected final TokenEndpointClient tokenEndpointClient
protected final OauthClientConfiguration oauthClientConfiguration
protected final java.util.Map<java.lang.String,org.reactivestreams.Publisher<TokenResponse>> scopeToPublisherMap
public AbstractClientCredentialsClient(@NonNull OauthClientConfiguration oauthClientConfiguration, @NonNull TokenEndpointClient tokenEndpointClient)
tokenEndpointClient
- The token endpoint clientoauthClientConfiguration
- The client configurationpublic java.lang.String getName()
@NonNull public org.reactivestreams.Publisher<TokenResponse> requestToken(@Nullable java.lang.String scope)
requestToken
in interface ClientCredentialsClient
scope
- Requested scope values for the access token.@NonNull public org.reactivestreams.Publisher<TokenResponse> requestToken(@Nullable java.lang.String scope, boolean force)
requestToken
in interface ClientCredentialsClient
scope
- Requested scope values for the access token.force
- true to invalidate the cached token response and fetch a new oneprotected boolean isExpired(@Nullable TokenResponse tokenResponse)
tokenResponse
- Token ResponseClientCredentialsConfiguration.getAdvancedExpiration()
) before current date.protected boolean isExpired(@NonNull java.util.Date expirationDate)
expirationDate
- ExpirationClientCredentialsConfiguration.getAdvancedExpiration()
) before current date.protected java.util.Optional<java.util.Date> expirationDate(@NonNull TokenResponse tokenResponse)
tokenResponse
- Token Responseprotected abstract ClientCredentialsTokenRequestContext createTokenRequestContext(@Nullable java.lang.String scope)
scope
- The requested scope for the client credentials request