Class HttpHeaderTokenWriter
- java.lang.Object
-
- io.micronaut.security.token.writer.HttpHeaderTokenWriter
-
- All Implemented Interfaces:
TokenWriter
@Singleton @Requires(property="micronaut.security.token.writer.header.enabled",notEquals="false") @Requires(beans=io.micronaut.security.token.writer.HttpHeaderTokenWriterConfiguration.class) public class HttpHeaderTokenWriter extends java.lang.Object implements TokenWriter
Write the token in an HTTP header.- Since:
- 1.0
- Author:
- Sergio del Amo
-
-
Field Summary
Fields Modifier and Type Field Description protected io.micronaut.security.token.writer.HttpHeaderTokenWriterConfiguration
httpHeaderTokenWriterConfiguration
-
Constructor Summary
Constructors Constructor Description HttpHeaderTokenWriter(io.micronaut.security.token.writer.HttpHeaderTokenWriterConfiguration httpHeaderTokenWriterConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getHeaderName()
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.
-
-
-
Constructor Detail
-
HttpHeaderTokenWriter
public HttpHeaderTokenWriter(io.micronaut.security.token.writer.HttpHeaderTokenWriterConfiguration httpHeaderTokenWriterConfiguration)
- Parameters:
httpHeaderTokenWriterConfiguration
- TheHttpHeaderTokenWriter
configuration
-
-
Method Detail
-
getHeaderName
protected java.lang.String getHeaderName()
- Returns:
- the HTTP Header name where the token will be written to
-
writeToken
public void writeToken(io.micronaut.http.MutableHttpRequest<?> request, java.lang.String token)
Writes the token to the request.- Specified by:
writeToken
in interfaceTokenWriter
- Parameters:
request
- TheMutableHttpRequest
instancetoken
- A token ( e.g. JWT token, basic auth token...)
-
headerValue
protected java.lang.String headerValue(java.lang.String token)
- Parameters:
token
- the token being written- Returns:
- the value which will be written to an HTTP Header
-
-