Skip to content

Commit

Permalink
Merge pull request #1 from wapacro/identity-api-upgrade
Browse files Browse the repository at this point in the history
Managed identity API upgrade
  • Loading branch information
Roman Ackermann authored May 22, 2020
2 parents d9e8c90 + 7ecde31 commit d0d56ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Client {

const OAUTH_API_VERSION = '2017-09-01';
const OAUTH_API_VERSION = '2019-08-01';
const VAULT_API_VERSION = '7.0';

/**
Expand All @@ -33,12 +33,12 @@ public function __construct() {
* @return string
*/
protected function getAccessToken() {
$endpoint = getenv('MSI_ENDPOINT');
$secret = getenv('MSI_SECRET');
$endpoint = getenv('IDENTITY_ENDPOINT');
$idHeader = getenv('IDENTITY_HEADER');
$resource = 'https://vault.azure.net';

$endpoint = Url::fromString($endpoint)->withQueryParameter('resource', $resource);
return 'Bearer ' . $this->get($endpoint, $secret, 'secret', self::OAUTH_API_VERSION)->access_token;
return 'Bearer ' . $this->get($endpoint, $idHeader, 'X-IDENTITY-HEADER', self::OAUTH_API_VERSION)->access_token;
}

/**
Expand Down

0 comments on commit d0d56ca

Please sign in to comment.