Class GrpcAuthUtils

java.lang.Object
io.deephaven.enterprise.auth.GrpcAuthUtils

public class GrpcAuthUtils extends Object
Common utilities for Auth over gRPC, including coversions to RPC service message types.
  • Field Details

    • ERROR_KEY

      public static final io.deephaven.shadow.core.io.grpc.Metadata.Key<AuthError> ERROR_KEY
  • Constructor Details

    • GrpcAuthUtils

      public GrpcAuthUtils()
  • Method Details

    • userContextAuthToProto

      public static UserContext userContextAuthToProto(UserContext authUserContext)
    • tokenAuthToProto

      public static Token tokenAuthToProto(AuthToken authToken)
    • userContextToAuthUserContext

      public static SimpleUserContext userContextToAuthUserContext(UserContext context)
    • tokenProtoToAuth

      public static AuthToken tokenProtoToAuth(Token token)
    • byteStringToInetAddress

      public static InetAddress byteStringToInetAddress(io.deephaven.shadow.core.com.google.protobuf.ByteString ipAddrAsByteString)
    • exceptionToAuthError

      public static AuthError exceptionToAuthError(Exception e)
    • authErrorToException

      public static AuthException authErrorToException(AuthError authError, com.fishlib.io.logger.Logger log)
    • makeClientId

      public static ClientId makeClientId(String name, byte[] uuid)
    • getClientHostname

      public static String getClientHostname()
    • getRandomUUID

      public static byte[] getRandomUUID()
    • makeCookie

      public static io.deephaven.shadow.core.com.google.protobuf.ByteString makeCookie(io.deephaven.shadow.core.com.google.protobuf.ByteString uuid, @NotNull SecureRandom secureRandom)
    • uuidFromCookie

      public static io.deephaven.shadow.core.com.google.protobuf.ByteString uuidFromCookie(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie)
    • uuidFromCookie

      public static byte[] uuidFromCookie(byte[] cookie)
    • uuidEqualsStr

      public static String uuidEqualsStr(io.deephaven.shadow.core.com.google.protobuf.ByteString uuid)
    • sessionDesc

      public static String sessionDesc(ClientId clientId)
    • onError

      public static void onError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, ClientId clientId, String logStr, Exception e, GrpcAuthUtils.LogStacktrace logStacktrace)
      Record that an error occurred during a gRPC request, log it and issue a gRPC StatusRuntimeException to the StreamObserver.
      Parameters:
      log - the log to record with
      observer - the observer to notify
      clientId - the ClientId of the request
      logStr - a messaged to be logged and observed
      e - the error that occurred
      logStacktrace - whether to log an stacktrace for the exception or not.
    • onError

      public static void onError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, ClientId clientId, String logStr, Exception e)
    • onError

      public static void onError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, String logStr, Exception e, GrpcAuthUtils.LogStacktrace logStacktrace)
    • onError

      public static void onError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, String logStr, Exception e)
    • onError

      public static void onError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, io.deephaven.shadow.core.com.google.protobuf.ByteString clientUuid, String logStr, Exception e)
    • onError

      public static void onError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, io.deephaven.shadow.core.com.google.protobuf.ByteString clientUuid, String logStr, Exception e, GrpcAuthUtils.LogStacktrace logStacktrace)
    • onError

      public static void onError(com.fishlib.io.log.LogEntry logEntry, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, String logStr, Exception e, GrpcAuthUtils.LogStacktrace logStacktrace)
      Log the message and exception using the given LogEntry, and send results to the observer. The LogEntry will be ended.
      Parameters:
      logEntry - a LogEntry to continue - this method will endl() the entry.
      observer - the result observer
      logStr - a message to be logged and observed
      e - an exception to be observed