public class AuthenticatedChannelClientDriver extends Object implements io.grpc.stub.StreamObserver<SaslMessage>
AuthenticatedChannelClientDriver
and AuthenticatedChannelServerDriver
respectively.
These drivers are wrappers over gRPC StreamObserver
s that manages the stream
traffic destined for the other participant. They make sure messages are exchanged between client
and server synchronously.
Authentication is initiated by the client. Following the initiate call, depending on the scheme,
one or more messages are exchanged to establish authenticated session between client and server.
After the authentication is established, client and server streams are not closed in order to use
them as long polling on authentication state changes.
-> Client closing the stream means that it doesn't want to be authenticated anymore.
-> Server closing the stream means the client is not authenticated at the server anymore.Constructor and Description |
---|
AuthenticatedChannelClientDriver(SaslClientHandler saslClientHandler,
GrpcChannelKey channelKey)
Creates client driver with given handshake handler.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Stops authenticated session with the server by releasing the long poll.
|
boolean |
isAuthenticated() |
void |
onCompleted() |
void |
onError(Throwable throwable) |
void |
onNext(SaslMessage saslMessage) |
void |
setServerObserver(io.grpc.stub.StreamObserver<SaslMessage> requestObserver)
Sets the server's Sasl stream.
|
void |
startAuthenticatedChannel(long timeoutMs)
Starts authentication with the server and wait until completion.
|
public AuthenticatedChannelClientDriver(SaslClientHandler saslClientHandler, GrpcChannelKey channelKey) throws SaslException
saslClientHandler
- sasl client handlerchannelKey
- channel keySaslException
public void setServerObserver(io.grpc.stub.StreamObserver<SaslMessage> requestObserver)
requestObserver
- server Sasl streampublic void onNext(SaslMessage saslMessage)
onNext
in interface io.grpc.stub.StreamObserver<SaslMessage>
public void onError(Throwable throwable)
onError
in interface io.grpc.stub.StreamObserver<SaslMessage>
public void onCompleted()
onCompleted
in interface io.grpc.stub.StreamObserver<SaslMessage>
public void close()
public boolean isAuthenticated()
true
if the channel is still authenticatedpublic void startAuthenticatedChannel(long timeoutMs) throws AlluxioStatusException
timeoutMs
- time to wait for authenticationUnauthenticatedException
AlluxioStatusException
Copyright © 2023. All Rights Reserved.