@Internal @EachBean(value=OauthClientConfiguration.class) @Requires(condition=ClientCredentialsEnabled.class) @Requires(condition=ClientCredentialsHeaderPropagatorEnabled.class) public class ClientCredentialsHeaderTokenPropagator extends java.lang.Object implements ClientCredentialsTokenPropagator
Modifier and Type | Field and Description |
---|---|
protected ClientCredentialsHeaderTokenPropagatorConfiguration |
configuration |
static java.lang.String |
SPACE |
Constructor and Description |
---|
ClientCredentialsHeaderTokenPropagator(ClientCredentialsHeaderTokenPropagatorConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Optional<java.lang.String> |
extractTokenFromAuthorization(java.lang.String authorization) |
java.util.Optional<java.lang.String> |
findToken(io.micronaut.http.HttpRequest<?> request)
Search for a JWT token in a HTTP request.
|
ClientCredentialsHeaderTokenPropagatorConfiguration |
getConfiguration() |
protected java.lang.String |
headerValue(java.lang.String token) |
void |
writeToken(io.micronaut.http.MutableHttpRequest<?> request,
java.lang.String token)
Writes the token to the request.
|
public static final java.lang.String SPACE
protected final ClientCredentialsHeaderTokenPropagatorConfiguration configuration
public ClientCredentialsHeaderTokenPropagator(ClientCredentialsHeaderTokenPropagatorConfiguration configuration)
configuration
- The token propagator configurationpublic void writeToken(@NonNull io.micronaut.http.MutableHttpRequest<?> request, @NonNull java.lang.String token)
writeToken
in interface ClientCredentialsTokenPropagator
request
- The MutableHttpRequest
instancetoken
- A token ( e.g. JWT token, basic auth token...)public java.util.Optional<java.lang.String> findToken(@NonNull io.micronaut.http.HttpRequest<?> request)
findToken
in interface ClientCredentialsTokenPropagator
request
- The request to look for the token inprotected java.lang.String headerValue(java.lang.String token)
token
- the token being writtenprotected java.util.Optional<java.lang.String> extractTokenFromAuthorization(java.lang.String authorization)
authorization
- Authorization header valuepublic ClientCredentialsHeaderTokenPropagatorConfiguration getConfiguration()