You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
677 B

<?php
3 years ago
declare(strict_types=1);
namespace authkit2\Oidc\Flows;
3 years ago
use authkit2\Oidc\Client;
use authkit2\Oidc\Token;
/**
3 years ago
* OpenId client_credentials grant flow.
*/
class ServiceAccountFlow
{
/**
3 years ago
* oidc client for making requests authenticated with our id/secret.
* @var Client
*/
protected $client;
/**
3 years ago
* Initialize a new service account flow.
*
* @param Client $client
*/
public function __construct(Client $client)
{
$this->client = $client;
}
/**
3 years ago
* Fetch a service account token for the initialized credentials.
*
* @return Token
*/
public function getServiceAccountToken(): Token
{
3 years ago
return $this->client->createTokenFromClient();
}
}