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