public class SSLContextGrpcAuthenticationReader extends Object implements GrpcAuthenticationReader
GrpcAuthenticationReader
that will try to use the peer certificates to extract the client
Authentication
. Currently this class only supports X509Certificate
s.Constructor and Description |
---|
SSLContextGrpcAuthenticationReader() |
Modifier and Type | Method and Description |
---|---|
protected Authentication |
fromCertificate(Certificate cert)
Tries to prepare an
Authentication using the given certificate. |
Authentication |
readAuthentication(ServerCall<?,?> call,
Metadata metadata)
Tries to read the
Authentication information from the given call and metadata. |
public Authentication readAuthentication(ServerCall<?,?> call, Metadata metadata)
GrpcAuthenticationReader
Authentication
information from the given call and metadata.
Note: Implementations are free to throw an AuthenticationException
if 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 subsequent GrpcAuthenticationReader
s should be called. Additionally, the call
will fail as Status.UNAUTHENTICATED
. If the call instead returns null
, then the call processing
will proceed unauthenticated.
readAuthentication
in interface GrpcAuthenticationReader
call
- The call to get that send the request.metadata
- The metadata/headers as sent by the client.@Nullable protected Authentication fromCertificate(Certificate cert)
Authentication
using the given certificate.cert
- The certificate to use.