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 AuthExceptionauthErrorToException(AuthError authError, com.fishlib.io.logger.Logger log) static InetAddressbyteStringToInetAddress(io.deephaven.shadow.core.com.google.protobuf.ByteString ipAddrAsByteString) static AuthErrorstatic Stringstatic byte[]static ClientIdmakeClientId(String name, byte[] uuid) static io.deephaven.shadow.core.com.google.protobuf.ByteStringmakeCookie(io.deephaven.shadow.core.com.google.protobuf.ByteString uuid, SecureRandom secureRandom) static voidonError(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 voidonError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, ClientId clientId, String logStr, Exception e) static voidonError(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 gRPCStatusRuntimeExceptionto theStreamObserver.static voidonError(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 voidonError(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 voidonError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, String logStr, Exception e) static voidonError(com.fishlib.io.logger.Logger log, io.deephaven.shadow.core.io.grpc.stub.StreamObserver<?> observer, String logStr, Exception e, GrpcAuthUtils.LogStacktrace logStacktrace) static StringsessionDesc(ClientId clientId) static TokentokenAuthToProto(AuthToken authToken) static AuthTokentokenProtoToAuth(Token token) static UserContextuserContextAuthToProto(UserContext authUserContext) static SimpleUserContextuserContextToAuthUserContext(UserContext context) static StringuuidEqualsStr(io.deephaven.shadow.core.com.google.protobuf.ByteString uuid) static byte[]uuidFromCookie(byte[] cookie) static io.deephaven.shadow.core.com.google.protobuf.ByteStringuuidFromCookie(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 gRPCStatusRuntimeExceptionto theStreamObserver.- Parameters:
log- the log to record withobserver- the observer to notifyclientId- theClientIdof 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
-