Class NativeSecretTokenSource
- All Implemented Interfaces:
TokenSource,AutoCloseable
client_secret - the platform's own credential, and the last
link of the resolution chain.
Last is a deliberate ordering, not a ranking of quality. A deployment that has configured an external identity has said something specific about how this workload proves itself; a client secret is very often left behind in a configuration file from an earlier setup. Preferring the secret would mean the external identity someone deliberately configured is quietly never used, and nothing would report it.
This source retains the secret, and it has to
A source that can re-mint after expiry or revocation must hold what it re-mints from. The
caller's SecretChars is therefore COPIED at construction rather than referenced, so the
caller's own try-with-resources can close theirs on the very next line without emptying this one.
The copy is zeroized by close().
-
Constructor Summary
ConstructorsConstructorDescriptionNativeSecretTokenSource(co.ankatech.ankasecure.openapi.client.AnkaSecureOpenApiClient client, String clientId, SecretChars clientSecret) -
Method Summary
Methods inherited from class co.ankatech.ankasecure.sdk.auth.CachingTokenSource
accessToken, cachedExpiry, currentTokenExpiry, hasCachedToken, invalidate
-
Constructor Details
-
NativeSecretTokenSource
public NativeSecretTokenSource(co.ankatech.ankasecure.openapi.client.AnkaSecureOpenApiClient client, String clientId, SecretChars clientSecret) - Parameters:
client- the transport to mint againstclientId- the actor UUID the platform issuedclientSecret- the secret; copied, not retained, and not closed by this constructor- Throws:
NullPointerException- if any argument isnull
-
-
Method Details
-
mechanism
Description copied from interface:TokenSourceNames the credential kind this source presents. Diagnostic only; nothing branches on it.- Returns:
- the mechanism; never
null
-
close
public void close()Description copied from class:CachingTokenSourceDiscards the cached token. Subclasses holding a credential for re-minting override this, release it, and callsuper.close().It performs the discard directly rather than by calling
CachingTokenSource.invalidate(). Once that method became overridable, routing close through it re-entered the override - so closing a federated source told its provider twice that its token was dead, the second time after the provider had already been closed. Closing releases; invalidating is a caller saying a credential went stale. They are different statements and only one of them belongs in a shutdown path.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTokenSource- Overrides:
closein classCachingTokenSource
-
toString
Names the mechanism and the actor. The secret has no representation here at all.
-