Package io.micronaut.security.token
Class TokenAuthenticationFetcher
- java.lang.Object
-
- io.micronaut.security.token.TokenAuthenticationFetcher
-
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,AuthenticationFetcher
@Singleton public class TokenAuthenticationFetcher extends java.lang.Object implements AuthenticationFetcher
Attempts to retrieve a token form theHttpRequestand if existing validated. It uses aTokenResolverand the list ofTokenValidatorregistered in the ApplicationContext.- Since:
- 1.0
- Author:
- Sergio del Amo, Graeme Rocher
-
-
Field Summary
Fields Modifier and Type Field Description protected io.micronaut.context.event.ApplicationEventPublishereventPublisherstatic java.lang.IntegerORDERThe order of the fetcher.protected java.util.Collection<TokenValidator>tokenValidators
-
Constructor Summary
Constructors Constructor Description TokenAuthenticationFetcher(java.util.Collection<TokenValidator> tokenValidators, TokenResolver tokenResolver, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)TokenAuthenticationFetcher(java.util.Collection<TokenValidator> tokenValidators, java.util.Collection<TokenReader> tokenReaders, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.reactivestreams.Publisher<Authentication>fetchAuthentication(io.micronaut.http.HttpRequest<?> request)Attempts to read anAuthenticationfrom aHttpRequestbeing executed.intgetOrder()
-
-
-
Field Detail
-
ORDER
public static final java.lang.Integer ORDER
The order of the fetcher.
-
tokenValidators
protected final java.util.Collection<TokenValidator> tokenValidators
-
eventPublisher
protected final io.micronaut.context.event.ApplicationEventPublisher eventPublisher
-
-
Constructor Detail
-
TokenAuthenticationFetcher
@Inject public TokenAuthenticationFetcher(java.util.Collection<TokenValidator> tokenValidators, TokenResolver tokenResolver, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
- Parameters:
tokenValidators- The list ofTokenValidatorwhich attempt to validate the requesttokenResolver- TheTokenResolverwhich returns the first found token in the request.eventPublisher- The Application event publisher
-
TokenAuthenticationFetcher
@Deprecated public TokenAuthenticationFetcher(java.util.Collection<TokenValidator> tokenValidators, java.util.Collection<TokenReader> tokenReaders, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
Deprecated.UseTokenAuthenticationFetcher(Collection, TokenResolver, ApplicationEventPublisher)instead. ATokenResolvercan be created usingDefaultTokenResolver(Collection).- Parameters:
tokenValidators- The list ofTokenValidatorwhich attempt to validate the requesttokenReaders- The listTokenReaderwhich attempt to read the requesteventPublisher- The Application event publisher
-
-
Method Detail
-
fetchAuthentication
public org.reactivestreams.Publisher<Authentication> fetchAuthentication(io.micronaut.http.HttpRequest<?> request)
Description copied from interface:AuthenticationFetcherAttempts to read anAuthenticationfrom aHttpRequestbeing executed.- Specified by:
fetchAuthenticationin interfaceAuthenticationFetcher- Parameters:
request-HttpRequestbeing executed.- Returns:
Authenticationif found
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered
-
-