PluginProbe ʕ •ᴥ•ʔ
Transferito: WP Migration / trunk
Transferito: WP Migration vtrunk
trunk 11.4.0 12.0.0 13.1.0 14.0.0 14.0.11 14.0.7 14.1.0 14.1.1 14.1.2 14.1.3 14.1.4
transferito / vendor / aws / aws-sdk-php / src / Token / SsoToken.php
transferito / vendor / aws / aws-sdk-php / src / Token Last commit date
BearerTokenAuthorization.php 11 months ago ParsesIniTrait.php 11 months ago RefreshableTokenProviderInterface.php 11 months ago SsoToken.php 11 months ago SsoTokenProvider.php 11 months ago Token.php 11 months ago TokenAuthorization.php 11 months ago TokenInterface.php 11 months ago TokenProvider.php 11 months ago
SsoToken.php
109 lines
1 <?php
2 namespace Aws\Token;
3
4 /**
5 * Token that comes from the SSO provider
6 */
7 class SsoToken extends Token
8 {
9 private $refreshToken;
10 private $clientId;
11 private $clientSecret;
12 private $registrationExpiresAt;
13 private $region;
14 private $startUrl;
15
16 /**
17 * Constructs a new SSO token object, with the specified AWS
18 * token
19 *
20 * @param string $token Security token to use
21 * @param int $expires UNIX timestamp for when the token expires
22 * @param int $refreshToken An opaque string returned by the sso-oidc service
23 * @param int $clientId The client ID generated when performing the registration portion of the OIDC authorization flow
24 * @param int $clientSecret The client secret generated when performing the registration portion of the OIDC authorization flow
25 * @param int $registrationExpiresAt The expiration time of the client registration (clientId and clientSecret)
26 * @param int $region The configured sso_region for the profile that credentials are being resolved for
27 * @param int $startUrl The configured sso_start_url for the profile that credentials are being resolved for
28 */
29 public function __construct(
30 $token,
31 $expires,
32 $refreshToken = null,
33 $clientId = null,
34 $clientSecret = null,
35 $registrationExpiresAt = null,
36 $region = null,
37 $startUrl = null
38 ) {
39 parent::__construct($token, $expires);
40 $this->refreshToken = $refreshToken;
41 $this->clientId = $clientId;
42 $this->clientSecret = $clientSecret;
43 $this->registrationExpiresAt = $registrationExpiresAt;
44 $this->region = $region;
45 $this->startUrl = $startUrl;
46 }
47
48 /**
49 * @return bool
50 */
51 public function isExpired()
52 {
53 if (isset($this->registrationExpiresAt)
54 && time() >= $this->registrationExpiresAt
55 ) {
56 return false;
57 }
58 return $this->expires !== null && time() >= $this->expires;
59 }
60
61 /**
62 * @return string|null
63 */
64 public function getRefreshToken()
65 {
66 return $this->refreshToken;
67 }
68
69 /**
70 * @return string|null
71 */
72 public function getClientId()
73 {
74 return $this->clientId;
75 }
76
77 /**
78 * @return string|null
79 */
80 public function getClientSecret()
81 {
82 return $this->clientSecret;
83 }
84
85 /**
86 * @return int|null
87 */
88 public function getRegistrationExpiresAt()
89 {
90 return $this->registrationExpiresAt;
91 }
92
93 /**
94 * @return string|null
95 */
96 public function getRegion()
97 {
98 return $this->region;
99 }
100
101 /**
102 * @return string|null
103 */
104 public function getStartUrl()
105 {
106 return $this->startUrl;
107 }
108 }
109