Package io.deephaven.enterprise.auth
Class AuthServerForwarder
java.lang.Object
io.deephaven.enterprise.auth.AuthServerForwarder
- All Implemented Interfaces:
AutoCloseable
Class to manage requests that need to go to a specific authentication server origin. Eg, verifying tokens.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getStub(InetAddress addr) otherPeers(InetAddress toExclude) Authentication server peers other than the provided oneintThe number of authentication servers availablepeers()Authentication server peersbooleanverifyChallenge(ClientId clientId, io.deephaven.shadow.core.com.google.protobuf.ByteString publicKey, UserContext userContext, InetAddress addy, io.deephaven.shadow.core.com.google.protobuf.ByteString challengeResponse, long remainingDeadlineAfterTimeMillis) booleanverifyTokenToOrigin(String service, AuthToken authToken, long remainingDeadlineTimeMillis) Verify an AuthToken to the particular authentication server that generated it.booleanverifyTokenToOriginOrThrow(String service, AuthToken authToken, long remainingDeadlineTimeMillis) Verify an AuthToken to the particular authentication server that generated it.
-
Constructor Details
-
AuthServerForwarder
public AuthServerForwarder()
-
-
Method Details
-
peers
Authentication server peers- Returns:
- a set of addresses for the authentication servers
-
peerCount
public int peerCount()The number of authentication servers available- Returns:
- the number of authentication servers available
-
otherPeers
Authentication server peers other than the provided one- Parameters:
toExclude- one authentication server to exclude from the result- Returns:
- a set of addresses for the authentication servers not included the provided one
-
verifyTokenToOrigin
public boolean verifyTokenToOrigin(String service, AuthToken authToken, long remainingDeadlineTimeMillis) Verify an AuthToken to the particular authentication server that generated it.- Parameters:
service- The service for which the token is intendedauthToken- The auth tokenremainingDeadlineTimeMillis- How much time is remaining in the deadline for this request- Returns:
- true if the token verifies correctly.
-
verifyTokenToOriginOrThrow
public boolean verifyTokenToOriginOrThrow(String service, AuthToken authToken, long remainingDeadlineTimeMillis) throws AuthServerForwarder.InvalidTokenOriginException Verify an AuthToken to the particular authentication server that generated it.- Parameters:
service- The service for which the token is intendedauthToken- The auth tokenremainingDeadlineTimeMillis- How much time is remaining in the deadline for this request- Returns:
- true if the token verifies correctly.
- Throws:
AuthServerForwarder.InvalidTokenOriginException- if the token origin address is not recognized as a valid origin addressio.deephaven.shadow.core.io.grpc.StatusRuntimeException- if the gRPC call failed
-
verifyChallenge
public boolean verifyChallenge(ClientId clientId, io.deephaven.shadow.core.com.google.protobuf.ByteString publicKey, UserContext userContext, InetAddress addy, io.deephaven.shadow.core.com.google.protobuf.ByteString challengeResponse, long remainingDeadlineAfterTimeMillis) -
getStub
public AuthApiGrpc.AuthApiStub getStub(InetAddress addr) throws AuthServerForwarder.InvalidTokenOriginException -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-