Package com.openai.auth
Interface SubjectTokenProvider
-
- All Implemented Interfaces:
public interface SubjectTokenProviderProvides a subject token for use in workload identity federation.
Implementations are responsible for obtaining a short-lived credential from the local environment (e.g. a cloud metadata server or a mounted Kubernetes secret) and returning it as a plain string.
-
-
Method Summary
Modifier and Type Method Description abstract SubjectTokenTypetokenType()Returns the format of the token produced by getToken and getTokenAsync. abstract StringgetToken(HttpClient httpClient, JsonMapper jsonMapper)Synchronously fetches a subject token. abstract CompletableFuture<String>getTokenAsync(HttpClient httpClient, JsonMapper jsonMapper)Asynchronously fetches a subject token. -
-
Method Detail
-
tokenType
abstract SubjectTokenType tokenType()
Returns the format of the token produced by getToken and getTokenAsync.
-
getToken
abstract String getToken(HttpClient httpClient, JsonMapper jsonMapper)
Synchronously fetches a subject token.
- Parameters:
httpClient- the HTTP client to use for any network requestsjsonMapper- the JSON mapper to use for deserializing responses- Returns:
the raw token string
-
getTokenAsync
abstract CompletableFuture<String> getTokenAsync(HttpClient httpClient, JsonMapper jsonMapper)
Asynchronously fetches a subject token.
- Parameters:
httpClient- the HTTP client to use for any network requestsjsonMapper- the JSON mapper to use for deserializing responses- Returns:
a CompletableFuture that completes with the raw token string
-
-
-
-