Class TokenAuthenticationFetcher

java.lang.Object
io.micronaut.security.token.TokenAuthenticationFetcher
All Implemented Interfaces:
io.micronaut.core.order.Ordered, AuthenticationFetcher<io.micronaut.http.HttpRequest<?>>

@Requires(classes=io.micronaut.http.HttpRequest.class) @Requires(beans=io.micronaut.http.server.util.HttpHostResolver.class) @Singleton public class TokenAuthenticationFetcher extends Object implements AuthenticationFetcher<io.micronaut.http.HttpRequest<?>>
Attempts to retrieve a token form the HttpRequest and if existing validated. It uses a TokenResolver and the list of TokenValidator registered in the ApplicationContext.

Token validators are consulted sequentially in order. The first validator which authenticates the token wins and the token is not handed to the remaining validators. Validators which perform remote calls, such as the OpenID provider UserInfo endpoint validator, should therefore have the lowest precedence so that they only receive tokens no local validator accepted.

Since:
1.0
Author:
Sergio del Amo, Graeme Rocher