Skip to content

Commit

Permalink
fix: sso token provider refresh (#2911)
Browse files Browse the repository at this point in the history
Fix the refresh implementation for SSO token provider.
  • Loading branch information
yenfryherrerafeliz authored Apr 25, 2024
1 parent c553a07 commit 578e289
Show file tree
Hide file tree
Showing 6 changed files with 243 additions and 133 deletions.
7 changes: 7 additions & 0 deletions .changes/nextrelease/fix-sso-token-refresh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "bugfix",
"category": "Credentials",
"description": "Makes the SSO token to be refreshed when required and allowed by the rules states on the sso token provider specs."
}
]
21 changes: 21 additions & 0 deletions src/Token/SsoToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,25 @@ public function getStartUrl()
{
return $this->startUrl;
}

/**
* Creates an instance of SsoToken from a token data.
*
* @param $tokenData
*
* @return SsoToken
*/
public static function fromTokenData($tokenData): SsoToken
{
return new SsoToken(
$tokenData['accessToken'],
\strtotime($tokenData['expiresAt']),
isset($tokenData['refreshToken']) ? $tokenData['refreshToken'] : null,
isset($tokenData['clientId']) ? $tokenData['clientId'] : null,
isset($tokenData['clientSecret']) ? $tokenData['clientSecret'] : null,
isset($tokenData['registrationExpiresAt']) ? $tokenData['registrationExpiresAt'] : null,
isset($tokenData['region']) ? $tokenData['region'] : null,
isset($tokenData['startUrl']) ? $tokenData['startUrl'] : null
);
}
}
Loading

0 comments on commit 578e289

Please sign in to comment.