Class JwtGrpcServerAuthenticationFetcher

java.lang.Object
io.micronaut.grpc.server.security.jwt.JwtGrpcServerAuthenticationFetcher
All Implemented Interfaces:
io.micronaut.core.order.Ordered, GrpcServerAuthenticationFetcher

@Singleton @Requires(classes=io.micronaut.security.token.validator.TokenValidator.class) @Requires(beans=GrpcServerSecurityJwtConfiguration.class) public final class JwtGrpcServerAuthenticationFetcher extends Object implements GrpcServerAuthenticationFetcher
Reads a JWT from gRPC metadata and authenticates it with Micronaut Security token validators.
Since:
5.0.0
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    JwtGrpcServerAuthenticationFetcher(GrpcServerSecurityJwtConfiguration configuration, Collection<io.micronaut.security.token.validator.TokenValidator<?>> tokenValidators)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T,S> @Nullable io.micronaut.security.authentication.Authentication
    fetchAuthentication(io.grpc.ServerCall<T,S> serverCall, io.grpc.Metadata metadata)
    Attempts to read an Authentication from the current server call.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Constructor Details

    • JwtGrpcServerAuthenticationFetcher

      public JwtGrpcServerAuthenticationFetcher(GrpcServerSecurityJwtConfiguration configuration, Collection<io.micronaut.security.token.validator.TokenValidator<?>> tokenValidators)
      Parameters:
      configuration - The JWT gRPC server security configuration
      tokenValidators - The Micronaut token validators
  • Method Details

    • fetchAuthentication

      @Nullable public <T,S> @Nullable io.micronaut.security.authentication.Authentication fetchAuthentication(io.grpc.ServerCall<T,S> serverCall, io.grpc.Metadata metadata)
      Description copied from interface: GrpcServerAuthenticationFetcher
      Attempts to read an Authentication from the current server call.
      Specified by:
      fetchAuthentication in interface GrpcServerAuthenticationFetcher
      Type Parameters:
      T - The request type
      S - The response type
      Parameters:
      serverCall - The current gRPC call
      metadata - The gRPC metadata
      Returns:
      The authentication when one is available