Package com.tuladb
Class Auth
java.lang.Object
com.tuladb.Auth
A connection credential for MSG_AUTH: a bearer token (JWT/OIDC) or an API
key that upgrades the connection's principal and role from the anonymous
default. Same frame and rules as the C SDK's
ledgerd_client_authenticate:
- sent right after the TCP connect / TLS handshake, before any request,
and again on every reconnect (
LedgerClient.withAuth(Auth), or theAuthargument ofSmartLedgerClient/LedgerClientPool); - refused on a plaintext connection unless
allowInsecure(boolean)(orTULADB_CLIENT_AUTH_ALLOW_INSECURE=1) says the transport is trusted (loopback, a TLS-terminating sidecar); - a rejected credential fails the connect with
LedgerClient.LedgerAuthException(status 35, ERR_PERMISSION); toString()never shows it; the client keeps its own copy in abyte[]and zeroes it onLedgerClient.clearAuth(). Prefer thebyte[]factories andwipe()your own copy: aStringcannot be cleared.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe engine's answer to a successful MSG_AUTH. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLongest credential the client sends (the C SDK's cap).static final byteThe engine's MSG_AUTH (0x70).static final intAPI key (WIRE_AUTH_TYPE_API_KEY).static final intJWT / OIDC bearer token (WIRE_AUTH_TYPE_BEARER). -
Method Summary
Modifier and TypeMethodDescriptionallowInsecure(boolean allow) A copy that may (or may not) be sent over a non-TLS connection.static AuthapiKey(byte[] key) static Authstatic Authbearer(byte[] token) static Authbooleanintlength()static Authof(int type, byte[] credential) credentialis copied.toString()inttype()voidwipe()Zero the credential in place.
-
Field Details
-
MSG_AUTH
public static final byte MSG_AUTHThe engine's MSG_AUTH (0x70).- See Also:
-
TYPE_BEARER
public static final int TYPE_BEARERJWT / OIDC bearer token (WIRE_AUTH_TYPE_BEARER).- See Also:
-
TYPE_API_KEY
public static final int TYPE_API_KEYAPI key (WIRE_AUTH_TYPE_API_KEY).- See Also:
-
MAX_CREDENTIAL_LEN
public static final int MAX_CREDENTIAL_LENLongest credential the client sends (the C SDK's cap).- See Also:
-
-
Method Details
-
of
credentialis copied. -
apiKey
-
apiKey
-
bearer
-
bearer
-
allowInsecure
A copy that may (or may not) be sent over a non-TLS connection. -
type
public int type() -
insecureAllowed
public boolean insecureAllowed() -
length
public int length() -
wipe
public void wipe()Zero the credential in place. -
toString
-