IAMClient

Client for the IAM service API

// Get AccessToken by IAM
<?php
use NextEvent\PHPSDK\Client;
use NextEvent\PHPSDK\Auth\IAMClient;

$credentials = ['user', 'password', 'scope']; // Your Credentials

$client = new Client($appUrl, $credentials, $widgetHash);

// stand alone
$iam_client = new IAMClient($credentials, $cache);
$token = $iam_client->getToken();

With the Token you can authorize requests to the NextEvent application by setting the Authorization Header.

$http->get(
  $url,
  ['headers' => [
    'Authorization' => $token->getAuthorizationHeader()
  ]]);
package

NextEvent\PHPSDK\Service

Methods

IAMClient constructor.

__construct(array $credentials, \NextEvent\PHPSDK\Store\StoreInterface $cache, \Psr\Log\LoggerInterface $logger) 

Arguments

$credentials

array

$logger

\Psr\Log\LoggerInterface

Forces the IAM Client to fetch a new token.

getNewToken() : \NextEvent\PHPSDK\Model\Token|null

Authenticate with IAM and get Token

getToken() : \NextEvent\PHPSDK\Model\Token|null
Throws
\NextEvent\PHPSDK\Exception\APIResponseException

Response

\NextEvent\PHPSDK\Model\Token|null

Cache setter

setCache(\NextEvent\PHPSDK\Store\StoreInterface $cache) 
Throws
\NextEvent\PHPSDK\Exception\InvalidStoreException

Arguments

Constants

IAM_TOKEN_KEY

IAM_TOKEN_KEY