Package com.openai.auth
Class AzureManagedIdentityTokenProvider
-
- All Implemented Interfaces:
-
com.openai.auth.SubjectTokenProvider
public final class AzureManagedIdentityTokenProvider implements SubjectTokenProvider
A SubjectTokenProvider that fetches an identity token from the Azure Instance Metadata Service (IMDS).
It calls the local IMDS endpoint and returns the
access_tokenfrom the response.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classAzureManagedIdentityTokenProvider.Builder
-
Method Summary
Modifier and Type Method Description SubjectTokenTypetokenType()Returns the format of the token produced by getToken and getTokenAsync. StringgetToken(HttpClient httpClient, JsonMapper jsonMapper)Synchronously fetches a subject token. CompletableFuture<String>getTokenAsync(HttpClient httpClient, JsonMapper jsonMapper)Asynchronously fetches a subject token. final static AzureManagedIdentityTokenProvider.Builderbuilder()-
-
Method Detail
-
tokenType
SubjectTokenType tokenType()
Returns the format of the token produced by getToken and getTokenAsync.
-
getToken
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
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
-
builder
final static AzureManagedIdentityTokenProvider.Builder builder()
-
-
-
-