Class CompositeGrpcAuthenticationReader
java.lang.Object
net.devh.boot.grpc.server.security.authentication.CompositeGrpcAuthenticationReader
- All Implemented Interfaces:
GrpcAuthenticationReader
Combines multiple
GrpcAuthenticationReader
into a single one. The readers will be executed in the same order
the are passed to the constructor. The authentication is aborted if a grpc authentication reader throws an exception.-
Constructor Summary
ConstructorsConstructorDescriptionCompositeGrpcAuthenticationReader
(List<GrpcAuthenticationReader> authenticationReaders) Creates a new CompositeGrpcAuthenticationReader with the given authentication readers. -
Method Summary
Modifier and TypeMethodDescriptionreadAuthentication
(ServerCall<?, ?> call, Metadata headers) Tries to read theAuthentication
information from the given call and metadata.
-
Constructor Details
-
CompositeGrpcAuthenticationReader
Creates a new CompositeGrpcAuthenticationReader with the given authentication readers.- Parameters:
authenticationReaders
- The authentication readers to use.
-
-
Method Details
-
readAuthentication
public Authentication readAuthentication(ServerCall<?, ?> call, Metadata headers) throws AuthenticationExceptionDescription copied from interface:GrpcAuthenticationReader
Tries to read theAuthentication
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 subsequentGrpcAuthenticationReader
s should be called. Additionally, the call will fail asStatus.UNAUTHENTICATED
. If the call instead returnsnull
, then the call processing will proceed unauthenticated.- Specified by:
readAuthentication
in interfaceGrpcAuthenticationReader
- Parameters:
call
- The call to get that send the request.headers
- The metadata/headers as sent by the client.- Returns:
- The authentication object or null if no authentication is present.
- Throws:
AuthenticationException
- If the authentication details are malformed or incomplete and thus the authentication attempt should be aborted.
-