From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- .../league/oauth2-client/src/Token/AccessToken.php | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 vendor/league/oauth2-client/src/Token/AccessToken.php (limited to 'vendor/league/oauth2-client/src/Token/AccessToken.php') diff --git a/vendor/league/oauth2-client/src/Token/AccessToken.php b/vendor/league/oauth2-client/src/Token/AccessToken.php new file mode 100755 index 0000000..bcfbfb1 --- /dev/null +++ b/vendor/league/oauth2-client/src/Token/AccessToken.php @@ -0,0 +1,77 @@ +accessToken = $options['access_token']; + + if (!empty($options['uid'])) { + $this->uid = $options['uid']; + } + + if (!empty($options['refresh_token'])) { + $this->refreshToken = $options['refresh_token']; + } + + // We need to know when the token expires. Show preference to + // 'expires_in' since it is defined in RFC6749 Section 5.1. + // Defer to 'expires' if it is provided instead. + if (!empty($options['expires_in'])) { + $this->expires = time() + ((int) $options['expires_in']); + } elseif (!empty($options['expires'])) { + // Some providers supply the seconds until expiration rather than + // the exact timestamp. Take a best guess at which we received. + $expires = $options['expires']; + $expiresInFuture = $expires > time(); + $this->expires = $expiresInFuture ? $expires : time() + ((int) $expires); + } + } + + /** + * Returns the token key. + * + * @return string + */ + public function __toString() + { + return (string) $this->accessToken; + } +} -- cgit v1.2.3-54-g00ecf