Package alluxio.security.authentication
Class AuthenticatedChannelClientDriver
- java.lang.Object
-
- alluxio.security.authentication.AuthenticatedChannelClientDriver
-
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage>
public class AuthenticatedChannelClientDriver extends java.lang.Object implements io.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage>
Responsible for driving authentication traffic from client-side. An authentication between client and server is managed byAuthenticatedChannelClientDriver
andAuthenticatedChannelServerDriver
respectively. These drivers are wrappers over gRPCStreamObserver
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 Summary
Constructors Constructor Description AuthenticatedChannelClientDriver(SaslClientHandler saslClientHandler, GrpcChannelKey channelKey)
Creates client driver with given handshake handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Stops authenticated session with the server by releasing the long poll.boolean
isAuthenticated()
void
onCompleted()
void
onError(java.lang.Throwable throwable)
void
onNext(alluxio.grpc.SaslMessage saslMessage)
void
setServerObserver(io.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage> requestObserver)
Sets the server's Sasl stream.void
startAuthenticatedChannel(long timeoutMs)
Starts authentication with the server and wait until completion.
-
-
-
Constructor Detail
-
AuthenticatedChannelClientDriver
public AuthenticatedChannelClientDriver(SaslClientHandler saslClientHandler, GrpcChannelKey channelKey) throws javax.security.sasl.SaslException
Creates client driver with given handshake handler.- Parameters:
saslClientHandler
- sasl client handlerchannelKey
- channel key- Throws:
javax.security.sasl.SaslException
-
-
Method Detail
-
setServerObserver
public void setServerObserver(io.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage> requestObserver)
Sets the server's Sasl stream.- Parameters:
requestObserver
- server Sasl stream
-
onNext
public void onNext(alluxio.grpc.SaslMessage saslMessage)
- Specified by:
onNext
in interfaceio.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage>
-
onError
public void onError(java.lang.Throwable throwable)
- Specified by:
onError
in interfaceio.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage>
-
onCompleted
public void onCompleted()
- Specified by:
onCompleted
in interfaceio.grpc.stub.StreamObserver<alluxio.grpc.SaslMessage>
-
close
public void close()
Stops authenticated session with the server by releasing the long poll.
-
isAuthenticated
public boolean isAuthenticated()
- Returns:
true
if the channel is still authenticated
-
startAuthenticatedChannel
public void startAuthenticatedChannel(long timeoutMs) throws AlluxioStatusException
Starts authentication with the server and wait until completion.- Parameters:
timeoutMs
- time to wait for authentication- Throws:
UnauthenticatedException
AlluxioStatusException
-
-