@Requires(property="micronaut.security.token.propagation.header.enabled", notEquals="false") @Singleton public class HttpHeaderTokenPropagator extends java.lang.Object implements TokenPropagator
Modifier and Type | Field and Description |
---|---|
protected HttpHeaderTokenPropagatorConfiguration |
configuration |
Constructor and Description |
---|
HttpHeaderTokenPropagator(HttpHeaderTokenPropagatorConfiguration 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.
|
HttpHeaderTokenPropagatorConfiguration |
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.
|
protected final HttpHeaderTokenPropagatorConfiguration configuration
public HttpHeaderTokenPropagator(HttpHeaderTokenPropagatorConfiguration configuration)
configuration
- The token propagator configurationpublic void writeToken(io.micronaut.http.MutableHttpRequest<?> request, java.lang.String token)
writeToken
in interface TokenPropagator
request
- The MutableHttpRequest
instancetoken
- A token ( e.g. JWT token, basic auth token...)public java.util.Optional<java.lang.String> findToken(io.micronaut.http.HttpRequest<?> request)
findToken
in interface TokenPropagator
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 HttpHeaderTokenPropagatorConfiguration getConfiguration()