Class ClientCredentialsHeaderTokenPropagator
java.lang.Object
io.micronaut.security.oauth2.client.clientcredentials.propagation.ClientCredentialsHeaderTokenPropagator
- All Implemented Interfaces:
- io.micronaut.core.order.Ordered,- ClientCredentialsTokenPropagator
- Direct Known Subclasses:
- DefaultClientCredentialsTokenPropagator
@Internal
@EachBean(OauthClientConfiguration.class)
@Requires(condition=ClientCredentialsEnabled.class) @Requires(condition=ClientCredentialsHeaderPropagatorEnabled.class)
public class ClientCredentialsHeaderTokenPropagator
extends Object
implements ClientCredentialsTokenPropagator
Propagates a token obtained via client credentials based off of a header.
- Since:
- 2.2.0
- Author:
- Sergio del Amo
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final ClientCredentialsHeaderTokenPropagatorConfigurationstatic final StringFields inherited from interface io.micronaut.core.order.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionClientCredentialsHeaderTokenPropagator(ClientCredentialsHeaderTokenPropagatorConfiguration configuration) 
- 
Method SummaryModifier and TypeMethodDescriptionextractTokenFromAuthorization(String authorization) findToken(@NonNull io.micronaut.http.HttpRequest<?> request) Search for a JWT token in a HTTP request.protected StringheaderValue(String token) voidwriteToken(@NonNull io.micronaut.http.MutableHttpRequest<?> request, @NonNull String token) Writes the token to the request.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.order.OrderedgetOrder
- 
Field Details- 
SPACE- See Also:
 
- 
configuration
 
- 
- 
Constructor Details- 
ClientCredentialsHeaderTokenPropagatorpublic ClientCredentialsHeaderTokenPropagator(ClientCredentialsHeaderTokenPropagatorConfiguration configuration) - Parameters:
- configuration- The token propagator configuration
 
 
- 
- 
Method Details- 
writeTokenpublic void writeToken(@NonNull @NonNull io.micronaut.http.MutableHttpRequest<?> request, @NonNull @NonNull String token) Writes the token to the request.- Specified by:
- writeTokenin interface- ClientCredentialsTokenPropagator
- Parameters:
- request- The- MutableHttpRequestinstance
- token- A token ( e.g. JWT token, basic auth token...)
 
- 
findTokenSearch for a JWT token in a HTTP request.- Specified by:
- findTokenin interface- ClientCredentialsTokenPropagator
- Parameters:
- request- The request to look for the token in
- Returns:
- if the JWT token is found it is returned, empty if not
 
- 
headerValue- Parameters:
- token- the token being written
- Returns:
- the value which will be written to an HTTP Header
 
- 
extractTokenFromAuthorization- Parameters:
- authorization- Authorization header value
- Returns:
- If prefix is 'Bearer' for 'Bearer XXX' it returns 'XXX'
 
- 
getConfiguration- Returns:
- The HttpHeaderTokenPropagator Configuration
 
 
-