SDK for PHP 3.x

SsoTokenProvider
in package
implements RefreshableTokenProviderInterface Uses ParsesIniTrait

Token that comes from the SSO provider

Table of Contents

Interfaces

RefreshableTokenProviderInterface
Provides access to an AWS token used for accessing AWS services

Constants

ENV_PROFILE  = 'AWS_PROFILE'
REFRESH_ATTEMPT_WINDOW_IN_SECS  = 30
REFRESH_WINDOW_IN_SECS  = 300

Methods

__construct()  : mixed
Constructs a new SsoTokenProvider object, which will fetch a token from an authenticated SSO profile
__invoke()  : PromiseInterface
Loads cached sso credentials.
getTokenData()  : array<string|int, mixed>
getTokenLocation()  : string
refresh()  : array<string|int, mixed>
This method attempt to refresh when possible.
shouldAttemptRefresh()  : bool
This method checks for whether a token refresh should happen.

Constants

ENV_PROFILE

public mixed ENV_PROFILE = 'AWS_PROFILE'

REFRESH_ATTEMPT_WINDOW_IN_SECS

public mixed REFRESH_ATTEMPT_WINDOW_IN_SECS = 30

REFRESH_WINDOW_IN_SECS

public mixed REFRESH_WINDOW_IN_SECS = 300

Methods

__construct()

Constructs a new SsoTokenProvider object, which will fetch a token from an authenticated SSO profile

public __construct(string $profileName[, string|null $configFilePath = null ][, SSOOIDCClient|null $ssoOidcClient = null ]) : mixed
Parameters
$profileName : string

The name of the profile that contains the sso_session key

$configFilePath : string|null = null

Name of the config file to sso profile from

$ssoOidcClient : SSOOIDCClient|null = null

The sso client for generating a new token

getTokenData()

public getTokenData( $tokenLocation) : array<string|int, mixed>
Parameters
$tokenLocation :
Return values
array<string|int, mixed>

getTokenLocation()

public static getTokenLocation( $sso_session) : string
Parameters
$sso_session :
Return values
string

refresh()

This method attempt to refresh when possible.

public refresh() : array<string|int, mixed>

If a refresh is not possible then it just returns the current token data as it is.

Tags
throws
TokenException
Return values
array<string|int, mixed>

shouldAttemptRefresh()

This method checks for whether a token refresh should happen.

public shouldAttemptRefresh() : bool

It will return true just if more than 30 seconds has happened since last refresh, and if the expiration is within a 5-minutes window from the current time.

Return values
bool
On this page