Package io.deephaven.enterprise.auth
Class GrpcAuthUtils
java.lang.Object
io.deephaven.enterprise.auth.GrpcAuthUtils
Common utilities for Auth over gRPC, including coversions to RPC service message types.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthException
authErrorToException
(AuthError authError, com.fishlib.io.logger.Logger log) static InetAddress
byteStringToInetAddress
(io.deephaven.shadow.core.com.google.protobuf.ByteString ipAddrAsByteString) static AuthError
static String
static byte[]
static ClientId
makeClientId
(String name, byte[] uuid) static io.deephaven.shadow.core.com.google.protobuf.ByteString
makeCookie
(io.deephaven.shadow.core.com.google.protobuf.ByteString uuid, SecureRandom secureRandom) 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.static void
onError
(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, ClientId clientId, String logStr, Exception e) 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 gRPCStatusRuntimeException
to theStreamObserver
.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) 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) static void
onError
(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, String logStr, Exception e) 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) static String
sessionDesc
(ClientId clientId) static Token
tokenAuthToProto
(AuthToken authToken) static AuthToken
tokenProtoToAuth
(Token token) static UserContext
userContextAuthToProto
(UserContext authUserContext) static SimpleUserContext
userContextToAuthUserContext
(UserContext context) static String
uuidEqualsStr
(io.deephaven.shadow.core.com.google.protobuf.ByteString uuid) static byte[]
uuidFromCookie
(byte[] cookie) static io.deephaven.shadow.core.com.google.protobuf.ByteString
uuidFromCookie
(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie)
-
Field Details
-
ERROR_KEY
-
-
Constructor Details
-
GrpcAuthUtils
public GrpcAuthUtils()
-
-
Method Details
-
userContextAuthToProto
-
tokenAuthToProto
-
userContextToAuthUserContext
-
tokenProtoToAuth
-
byteStringToInetAddress
public static InetAddress byteStringToInetAddress(io.deephaven.shadow.core.com.google.protobuf.ByteString ipAddrAsByteString) -
exceptionToAuthError
-
authErrorToException
public static AuthException authErrorToException(AuthError authError, com.fishlib.io.logger.Logger log) -
makeClientId
-
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
-
sessionDesc
-
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 gRPCStatusRuntimeException
to theStreamObserver
.- Parameters:
log
- the log to record withobserver
- the observer to notifyclientId
- theClientId
of the requestlogStr
- a messaged to be logged and observede
- the error that occurredlogStacktrace
- whether to log an stacktrace for the exception or not.
-
onError
-
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
-
onError
-
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 observerlogStr
- a message to be logged and observede
- an exception to be observed
-