ManagedIdentityCredential
in package
implements
TokenCredential
FinalYes
Tags
Table of Contents
Interfaces
- TokenCredential
- Defines how an Azure credential obtains access tokens.
Constants
- APP_SERVICE_API_VERSION : mixed = '2019-08-01'
- ARC_API_VERSION : mixed = '2020-06-01'
- IMDS_API_VERSION : mixed = '2018-02-01'
- IMDS_ENDPOINT : mixed = 'http://169.254.169.254/metadata/identity/oauth...
- LEGACY_MSI_API_VERSION : mixed = '2017-09-01'
Properties
Methods
- __construct() : mixed
- getToken() : AccessToken
- Requests an access token for the supplied OAuth scopes.
- appendQuery() : string
- detectEnvironment() : string
- discoverClientAndRequestFactory() : RequestFactoryInterface}
- getStringEnv() : string|null
- getTokenFromAppService() : AccessToken
- getTokenFromAzureArc() : AccessToken
- getTokenFromImds() : AccessToken
- getTokenFromMsiEndpoint() : AccessToken
- handleImdsResponse() : AccessToken
- parseWwwAuthenticateBasicRealm() : string|null
- readSecretFile() : string
- requestToken() : ResponseInterface
- scopeToResource() : string
Constants
APP_SERVICE_API_VERSION
private
mixed
APP_SERVICE_API_VERSION
= '2019-08-01'
ARC_API_VERSION
private
mixed
ARC_API_VERSION
= '2020-06-01'
IMDS_API_VERSION
private
mixed
IMDS_API_VERSION
= '2018-02-01'
IMDS_ENDPOINT
private
mixed
IMDS_ENDPOINT
= 'http://169.254.169.254/metadata/identity/oauth2/token'
LEGACY_MSI_API_VERSION
private
mixed
LEGACY_MSI_API_VERSION
= '2017-09-01'
Properties
$options
private
ManagedIdentityCredentialOptions
$options
= new ManagedIdentityCredentialOptions()
Methods
__construct()
public
__construct([ManagedIdentityCredentialOptions $options = new ManagedIdentityCredentialOptions() ]) : mixed
Parameters
- $options : ManagedIdentityCredentialOptions = new ManagedIdentityCredentialOptions()
getToken()
Requests an access token for the supplied OAuth scopes.
public
getToken(TokenRequestContext $context) : AccessToken
Parameters
- $context : TokenRequestContext
Return values
AccessTokenappendQuery()
private
static appendQuery(string $url, array<string, mixed> $query) : string
Parameters
- $url : string
- $query : array<string, mixed>
Return values
stringdetectEnvironment()
private
detectEnvironment(string|null $identityEndpoint, string|null $identityHeader, string|null $imdsEndpoint, string|null $msiEndpoint) : string
Parameters
- $identityEndpoint : string|null
- $identityHeader : string|null
- $imdsEndpoint : string|null
- $msiEndpoint : string|null
Return values
stringdiscoverClientAndRequestFactory()
private
discoverClientAndRequestFactory() : RequestFactoryInterface}
Return values
RequestFactoryInterface}getStringEnv()
private
getStringEnv(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetTokenFromAppService()
private
getTokenFromAppService(string $resource, string $identityEndpoint, string $identityHeader, string|null $clientId) : AccessToken
Parameters
- $resource : string
- $identityEndpoint : string
- $identityHeader : string
- $clientId : string|null
Return values
AccessTokengetTokenFromAzureArc()
private
getTokenFromAzureArc(string $resource, string $identityEndpoint) : AccessToken
Parameters
- $resource : string
- $identityEndpoint : string
Return values
AccessTokengetTokenFromImds()
private
getTokenFromImds(string $resource, string|null $clientId) : AccessToken
Parameters
- $resource : string
- $clientId : string|null
Return values
AccessTokengetTokenFromMsiEndpoint()
private
getTokenFromMsiEndpoint(string $resource, string $msiEndpoint, string|null $msiSecret, string|null $clientId) : AccessToken
Parameters
- $resource : string
- $msiEndpoint : string
- $msiSecret : string|null
- $clientId : string|null
Return values
AccessTokenhandleImdsResponse()
private
handleImdsResponse(ResponseInterface $response) : AccessToken
Parameters
- $response : ResponseInterface
Return values
AccessTokenparseWwwAuthenticateBasicRealm()
private
parseWwwAuthenticateBasicRealm(string $header) : string|null
Parameters
- $header : string
Return values
string|nullreadSecretFile()
private
readSecretFile(string $path) : string
Parameters
- $path : string
Return values
stringrequestToken()
private
requestToken(ClientInterface $client, RequestFactoryInterface $requestFactory, string $url, array<string, string> $headers, array<string, mixed> $query, string $source) : ResponseInterface
Parameters
- $client : ClientInterface
- $requestFactory : RequestFactoryInterface
- $url : string
- $headers : array<string, string>
- $query : array<string, mixed>
- $source : string
Return values
ResponseInterfacescopeToResource()
private
scopeToResource(TokenRequestContext $context) : string
Parameters
- $context : TokenRequestContext