mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-15 17:58:56 +05:30
Renamed method make
to generate
This commit is contained in:
parent
ac29fc4a62
commit
b2c07aa68f
@ -115,7 +115,7 @@ abstract class AbstractToken
|
|||||||
*/
|
*/
|
||||||
public function setToken($token = null)
|
public function setToken($token = null)
|
||||||
{
|
{
|
||||||
$this->token = ($token !== null) ? $token : SecureKey::make();
|
$this->token = ($token !== null) ? $token : SecureKey::generate();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class AuthCode extends AbstractGrant
|
|||||||
|
|
||||||
// Create a new auth code
|
// Create a new auth code
|
||||||
$authCode = new AC($this->server);
|
$authCode = new AC($this->server);
|
||||||
$authCode->setToken(SecureKey::make());
|
$authCode->setToken(SecureKey::generate());
|
||||||
$authCode->setRedirectUri($authParams['redirect_uri']);
|
$authCode->setRedirectUri($authParams['redirect_uri']);
|
||||||
|
|
||||||
foreach ($authParams['scopes'] as $scope) {
|
foreach ($authParams['scopes'] as $scope) {
|
||||||
@ -250,7 +250,7 @@ class AuthCode extends AbstractGrant
|
|||||||
|
|
||||||
// Generate the access token
|
// Generate the access token
|
||||||
$accessToken = new AccessToken($this->server);
|
$accessToken = new AccessToken($this->server);
|
||||||
$accessToken->setToken(SecureKey::make());
|
$accessToken->setToken(SecureKey::generate());
|
||||||
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
|
|
||||||
foreach ($authCodeScopes as $authCodeScope) {
|
foreach ($authCodeScopes as $authCodeScope) {
|
||||||
@ -267,7 +267,7 @@ class AuthCode extends AbstractGrant
|
|||||||
// Associate a refresh token if set
|
// Associate a refresh token if set
|
||||||
if ($this->server->hasGrantType('refresh_token')) {
|
if ($this->server->hasGrantType('refresh_token')) {
|
||||||
$refreshToken = new RefreshToken($this->server);
|
$refreshToken = new RefreshToken($this->server);
|
||||||
$refreshToken->setToken(SecureKey::make());
|
$refreshToken->setToken(SecureKey::generate());
|
||||||
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
||||||
$response['refresh_token'] = $refreshToken->getToken();
|
$response['refresh_token'] = $refreshToken->getToken();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class ClientCredentials extends AbstractGrant
|
|||||||
|
|
||||||
// Generate an access token
|
// Generate an access token
|
||||||
$accessToken = new AccessToken($this->server);
|
$accessToken = new AccessToken($this->server);
|
||||||
$accessToken->setToken(SecureKey::make());
|
$accessToken->setToken(SecureKey::generate());
|
||||||
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
|
|
||||||
// Associate scopes with the session and access token
|
// Associate scopes with the session and access token
|
||||||
|
@ -146,7 +146,7 @@ class Password extends AbstractGrant
|
|||||||
|
|
||||||
// Generate an access token
|
// Generate an access token
|
||||||
$accessToken = new AccessToken($this->server);
|
$accessToken = new AccessToken($this->server);
|
||||||
$accessToken->setToken(SecureKey::make());
|
$accessToken->setToken(SecureKey::generate());
|
||||||
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
|
|
||||||
// Associate scopes with the session and access token
|
// Associate scopes with the session and access token
|
||||||
@ -165,7 +165,7 @@ class Password extends AbstractGrant
|
|||||||
// Associate a refresh token if set
|
// Associate a refresh token if set
|
||||||
if ($this->server->hasGrantType('refresh_token')) {
|
if ($this->server->hasGrantType('refresh_token')) {
|
||||||
$refreshToken = new RT($this->server);
|
$refreshToken = new RT($this->server);
|
||||||
$refreshToken->setToken(SecureKey::make());
|
$refreshToken->setToken(SecureKey::generate());
|
||||||
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
||||||
$response['refresh_token'] = $refreshToken->getToken();
|
$response['refresh_token'] = $refreshToken->getToken();
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class RefreshToken extends AbstractGrant
|
|||||||
|
|
||||||
// Generate a new access token and assign it the correct sessions
|
// Generate a new access token and assign it the correct sessions
|
||||||
$newAccessToken = new AccessToken($this->server);
|
$newAccessToken = new AccessToken($this->server);
|
||||||
$newAccessToken->setToken(SecureKey::make());
|
$newAccessToken->setToken(SecureKey::generate());
|
||||||
$newAccessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$newAccessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
$newAccessToken->setSession($session);
|
$newAccessToken->setSession($session);
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class RefreshToken extends AbstractGrant
|
|||||||
|
|
||||||
// Generate a new refresh token
|
// Generate a new refresh token
|
||||||
$newRefreshToken = new RT($this->server);
|
$newRefreshToken = new RT($this->server);
|
||||||
$newRefreshToken->setToken(SecureKey::make());
|
$newRefreshToken->setToken(SecureKey::generate());
|
||||||
$newRefreshToken->setExpireTime($this->getRefreshTokenTTL() + time());
|
$newRefreshToken->setExpireTime($this->getRefreshTokenTTL() + time());
|
||||||
$newRefreshToken->setAccessToken($newAccessToken);
|
$newRefreshToken->setAccessToken($newAccessToken);
|
||||||
$newRefreshToken->save($this->server->getStorage('refresh_token'));
|
$newRefreshToken->save($this->server->getStorage('refresh_token'));
|
||||||
|
Loading…
Reference in New Issue
Block a user