Class 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 the HttpRequest and if existing validated. It uses a TokenResolver and the list of TokenValidator registered in the ApplicationContext.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected io.micronaut.context.event.ApplicationEventPublisher eventPublisher  
      static java.lang.Integer ORDER
      The order of the fetcher.
      protected java.util.Collection<TokenValidator> tokenValidators  
      • Fields inherited from interface io.micronaut.core.order.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • 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 of TokenValidator which attempt to validate the request
        tokenResolver - The TokenResolver which returns the first found token in the request.
        eventPublisher - The Application event publisher
    • Method Detail

      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface io.micronaut.core.order.Ordered