KMP PHP API Reference

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

$client  : Client
$clientId  : string|null
$resource  : string

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

Properties

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
AccessToken

getTokenFromAppServiceEndpoint()

Fetch a token from App Service/Container Apps managed identity endpoint.

private getTokenFromAppServiceEndpoint(string $endpoint) : AccessToken
Parameters
$endpoint : string

Identity endpoint URL

Return values
AccessToken

getTokenFromImds()

Fetch a token from the Azure Instance Metadata Service endpoint.

private getTokenFromImds() : AccessToken
Return values
AccessToken

requestToken()

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

Return values
AccessToken
On this page

Search results