@Singleton public class TokenAuthenticationFetcher extends java.lang.Object implements AuthenticationFetcher
HttpRequest
and if existing validated.
It uses a TokenResolver
and the list of TokenValidator
registered in the ApplicationContext.Modifier and Type | Field and Description |
---|---|
protected io.micronaut.context.event.ApplicationEventPublisher |
eventPublisher |
static java.lang.Integer |
ORDER
The order of the fetcher.
|
protected java.util.Collection<TokenValidator> |
tokenValidators |
Constructor and Description |
---|
TokenAuthenticationFetcher(java.util.Collection<TokenValidator> tokenValidators,
TokenResolver tokenResolver,
io.micronaut.context.event.ApplicationEventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<Authentication> |
fetchAuthentication(io.micronaut.http.HttpRequest<?> request)
Attempts to read an
Authentication from a HttpRequest being executed. |
int |
getOrder() |
public static final java.lang.Integer ORDER
protected final java.util.Collection<TokenValidator> tokenValidators
protected final io.micronaut.context.event.ApplicationEventPublisher eventPublisher
@Inject public TokenAuthenticationFetcher(java.util.Collection<TokenValidator> tokenValidators, TokenResolver tokenResolver, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
tokenValidators
- The list of TokenValidator
which attempt to validate the requesttokenResolver
- The TokenResolver
which returns the first found token in the request.eventPublisher
- The Application event publisherpublic org.reactivestreams.Publisher<Authentication> fetchAuthentication(io.micronaut.http.HttpRequest<?> request)
AuthenticationFetcher
Authentication
from a HttpRequest
being executed.fetchAuthentication
in interface AuthenticationFetcher
request
- HttpRequest
being executed.Authentication
if foundpublic int getOrder()
getOrder
in interface io.micronaut.core.order.Ordered