AzureManagedIdentityTokenCredential
in package
implements
TokenCredential
Token credential for Azure managed identity in App Service/Container Apps or IMDS.
Table of Contents
Interfaces
- TokenCredential
Constants
- RESOURCE : mixed = 'https://storage.azure.com/'
Properties
Methods
- __construct() : mixed
- Constructor.
- getToken() : AccessToken
- Fetch an access token for the configured Azure audience.
- getTokenFromAppServiceEndpoint() : AccessToken
- Fetch a token from App Service/Container Apps managed identity endpoint.
- getTokenFromImds() : AccessToken
- Fetch a token from the Azure Instance Metadata Service endpoint.
- requestToken() : AccessToken
Constants
RESOURCE
private
mixed
RESOURCE
= 'https://storage.azure.com/'
Properties
$client
private
Client
$client
$clientId read-only
private
string|null
$clientId
= null
$resource read-only
private
string
$resource
= self::RESOURCE
Methods
__construct()
Constructor.
public
__construct([string|null $clientId = null ][, Client|null $client = null ][, string $resource = self::RESOURCE ]) : mixed
Parameters
- $clientId : string|null = null
-
User-assigned managed identity client ID
- $client : Client|null = null
-
HTTP client
- $resource : string = self::RESOURCE
-
Allowed token audience
getToken()
Fetch an access token for the configured Azure audience.
public
getToken(TokenRequestContext $context) : AccessToken
Parameters
- $context : TokenRequestContext
-
Requested OAuth scopes
Return values
AccessTokengetTokenFromAppServiceEndpoint()
Fetch a token from App Service/Container Apps managed identity endpoint.
private
getTokenFromAppServiceEndpoint(string $endpoint) : AccessToken
Parameters
- $endpoint : string
-
Identity endpoint URL
Return values
AccessTokengetTokenFromImds()
Fetch a token from the Azure Instance Metadata Service endpoint.
private
getTokenFromImds() : AccessToken
Return values
AccessTokenrequestToken()
private
requestToken(string $endpoint, array<string, string> $headers, array<string, string> $query) : AccessToken
Parameters
- $endpoint : string
- $headers : array<string, string>
-
Request headers
- $query : array<string, string>
-
Query parameters