org.llm4s.llmconnect.auth
Members list
Type members
Classlikes
A bearer token and when it stops being valid. The value is redacted in toString.
A bearer token and when it stops being valid. The value is redacted in toString.
Build one with the companion apply and change it with the with* setters; the constructor is private, so a field can be added without breaking callers (#1818).
Attributes
- Companion
- object
- Source
- AccessTokenProvider.scala
- Supertypes
Attributes
- Companion
- class
- Source
- AccessTokenProvider.scala
- Supertypes
- Self type
-
AccessToken.type
Supplies the bearer token for each request, refreshing it as needed.
Supplies the bearer token for each request, refreshing it as needed.
Stable since #1818: OpenAICompatibleClient.Credential.Dynamic takes one. An implementation should return a failure as a Left rather than throw; a client that calls it turns a thrown exception into an AuthenticationError all the same.
Attributes
- Source
- AccessTokenProvider.scala
- Supertypes
- Known subtypes
Supplies the API key a client sends, asked once per request, so a key rotated by a secret manager is used without rebuilding the client (#2313).
Supplies the API key a client sends, asked once per request, so a key rotated by a secret manager is used without rebuilding the client (#2313).
A config carries one as ProviderConfig.apiKeyProvider: a section's apiKeyFile sets ApiKeyProvider.file, and code sets any implementation with withApiKeyProvider - one backed by Vault, AWS Secrets Manager or another secret store, which llm4s does not depend on. current() is called on the request path, so an implementation caches and fetches again only when the key may have changed. It returns a failure as a Left rather than throwing; a client turns a thrown exception into a failed request all the same.
The key is an ApiKey, so creating one registers it for redaction: an error that echoes a rotated key is scrubbed of it too.
Stable, as AccessTokenProvider is: the Stable configs that support it (OpenAIConfig, AnthropicConfig, OpenAICompatibleConfig, AzureConfig, GeminiConfig, DeepSeekConfig, ZaiConfig) carry one, as do the Mistral, Cohere, xAI and watsonx configs (#2477).
Attributes
- Companion
- object
- Source
- ApiKeyProvider.scala
- Supertypes
- Known subtypes
-
class VaultApiKeyProvider
Attributes
- Companion
- trait
- Source
- ApiKeyProvider.scala
- Supertypes
- Self type
-
ApiKeyProvider.type
A named provider section's auth block: the workload's identity token, plus the keys the provider declares in ProviderConfigSpec.authExtras (a token URL, a federation rule id, ...), resolved by validation. Values are redacted in toString.
A named provider section's auth block: the workload's identity token, plus the keys the provider declares in ProviderConfigSpec.authExtras (a token URL, a federation rule id, ...), resolved by validation. Values are redacted in toString.
Extras are trimmed and a blank one is dropped, however the config is built - as a section's auth block is read - so a blank clientId is absent rather than posted empty, and a required key left blank is reported as missing.
Stable since #1818: it is a field of the Stable NamedProviderConfig and a parameter of ProviderDescriptor.requireAuthExtra, so its shape is covered by the 1.x promise with theirs.
Attributes
- Companion
- object
- Source
- AuthConfig.scala
- Supertypes
Attributes
- Companion
- class
- Source
- AuthConfig.scala
- Supertypes
- Self type
-
AuthConfig.type
Caches the token fetch returns until refreshMargin before it expires - or half-way through its life, if it lives shorter than twice the margin. Concurrent callers share one in-flight fetch.
Caches the token fetch returns until refreshMargin before it expires - or half-way through its life, if it lives shorter than twice the margin. Concurrent callers share one in-flight fetch.
A failed fetch is shared for a brief window: the callers waiting behind it get the same failure at once instead of each making their own attempt in turn, which during an outage would hold the last of N callers for N times the exchange's timeout. A rejection (an authentication or configuration error, or any other error not marked recoverable) is shared for FailureTtl (5 seconds); a transient failure (a org.llm4s.error.RecoverableError: network, timeout, rate limit, 5xx) for TransientFailureTtl (1 second) - long enough for the callers queued behind the fetch, short enough that a blip does not outlive itself. After the window the next call tries again; a success, or a rejected cached token, ends it sooner.
A fetch that throws instead of returning a Left fails like one that returned an AuthenticationError naming the exception's class (not its message, which may hold a credential): token() never throws for it.
A cancellation is never shared. A fetch whose thread is interrupted - it returns CancelledError, throws InterruptedException, or fails while the flag is set - returns CancelledError to that caller alone, with its interrupt flag set, and caches nothing: the next caller through the lock makes its own fetch.
Attributes
- Companion
- object
- Source
- AccessTokenProvider.scala
- Supertypes
Attributes
- Companion
- class
- Source
- AccessTokenProvider.scala
- Supertypes
- Self type
Where a workload's identity token comes from - typically a SPIFFE JWT-SVID file that spiffe-helper keeps fresh. The configured form, before it is read. Stable since #1818, as part of the workload-identity configuration the Stable configs carry.
Where a workload's identity token comes from - typically a SPIFFE JWT-SVID file that spiffe-helper keeps fresh. The configured form, before it is read. Stable since #1818, as part of the workload-identity configuration the Stable configs carry.
Attributes
- Source
- IdentityTokenSource.scala
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Fetches the subject token a token exchange presents.
Fetches the subject token a token exchange presents.
Attributes
- Companion
- object
- Source
- IdentityTokenSource.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- IdentityTokenSource.scala
- Supertypes
- Self type
-
IdentityTokenSource.type
The RFC 8693 token exchange and its caching provider.
The RFC 8693 token exchange and its caching provider.
Attributes
- Source
- TokenExchange.scala
- Supertypes
- Self type
-
TokenExchange.type
An RFC 8693 token exchange: present identityToken at tokenUrl, get back a short-lived bearer token. Databricks workload identity federation is one such endpoint (https://<workspace>/oidc/v1/token, scope = all-apis, clientId = the service principal).
An RFC 8693 token exchange: present identityToken at tokenUrl, get back a short-lived bearer token. Databricks workload identity federation is one such endpoint (https://<workspace>/oidc/v1/token, scope = all-apis, clientId = the service principal).
toString shows tokenUrl without its userinfo or query, which may carry credentials, and redacts clientId.
Stable since #1818: OpenAICompatibleConfig.tokenExchange and OpenAICompatibleClient.Credential.Exchange carry it. The exchange itself (TokenExchange) is still Experimental.
Attributes
- Companion
- object
- Source
- TokenExchange.scala
- Supertypes
Attributes
- Companion
- class
- Source
- TokenExchange.scala
- Supertypes
- Self type
-
TokenExchangeConfig.type
