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
ConstructorsConstructorDescriptionJwtGrpcServerAuthenticationFetcher(GrpcServerSecurityJwtConfiguration configuration, Collection<io.micronaut.security.token.validator.TokenValidator<?>> tokenValidators) -
Method Summary
Modifier and TypeMethodDescription<T,S> @Nullable io.micronaut.security.authentication.Authentication fetchAuthentication(io.grpc.ServerCall<T, S> serverCall, io.grpc.Metadata metadata) Attempts to read anAuthenticationfrom the current server call.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 configurationtokenValidators- 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:GrpcServerAuthenticationFetcherAttempts to read anAuthenticationfrom the current server call.- Specified by:
fetchAuthenticationin interfaceGrpcServerAuthenticationFetcher- Type Parameters:
T- The request typeS- The response type- Parameters:
serverCall- The current gRPC callmetadata- The gRPC metadata- Returns:
- The authentication when one is available
-