syntax = "proto2";

option java_multiple_files = true;
option java_package = "alluxio.grpc";
option java_outer_classname = "AuthenticationServerProto";

package alluxio.grpc.sasl;

enum SaslMessageType {
  CHALLENGE = 0;
  SUCCESS = 1;
}

enum ChannelAuthenticationScheme {
  NOSASL = 0;
  SIMPLE = 1;
  CUSTOM = 2;
}

message SaslMessage {
  optional SaslMessageType messageType = 1;
  optional bytes message = 2;
  optional string clientId = 3;
  optional ChannelAuthenticationScheme authenticationScheme = 4;
  optional string channelRef = 5;
}

service SaslAuthenticationService {

  /**
   * Used to drive Sasl negotiation with clients.
   */
  rpc authenticate(stream SaslMessage) returns (stream SaslMessage);
}
