Class SSLContextGrpcAuthenticationReader
java.lang.Object
net.devh.boot.grpc.server.security.authentication.SSLContextGrpcAuthenticationReader
- All Implemented Interfaces:
GrpcAuthenticationReader
An
GrpcAuthenticationReader that will try to use the peer certificates to extract the client
Authentication. Currently this class only supports X509Certificates.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AuthenticationfromCertificate(Certificate cert) Tries to prepare anAuthenticationusing the given certificate.readAuthentication(ServerCall<?, ?> call, Metadata metadata) Tries to read theAuthenticationinformation from the given call and metadata.
-
Constructor Details
-
SSLContextGrpcAuthenticationReader
public SSLContextGrpcAuthenticationReader()
-
-
Method Details
-
readAuthentication
Description copied from interface:GrpcAuthenticationReaderTries to read theAuthenticationinformation from the given call and metadata.Note: Implementations are free to throw an
AuthenticationExceptionif no credentials could be found in the call. If an exception is thrown by an implementation then the authentication attempt should be considered as failed and no subsequentGrpcAuthenticationReaders should be called. Additionally, the call will fail asStatus.UNAUTHENTICATED. If the call instead returnsnull, then the call processing will proceed unauthenticated.- Specified by:
readAuthenticationin interfaceGrpcAuthenticationReader- Parameters:
call- The call to get that send the request.metadata- The metadata/headers as sent by the client.- Returns:
- The authentication object or null if no authentication is present.
-
fromCertificate
Tries to prepare anAuthenticationusing the given certificate.- Parameters:
cert- The certificate to use.- Returns:
- The authentication instance created with the certificate or null if the certificate type is unsupported.
-