mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-04-11 21:39:10 +05:30
Associate scopes to auth codes in separate method. Creating an auth code now returns an ID
This commit is contained in:
parent
9372cc85d0
commit
aa8d38108f
@ -193,13 +193,6 @@ class AuthCode implements GrantTypeInterface {
|
||||
// Remove any old sessions the user might have
|
||||
$this->authServer->getStorage('session')->deleteSession($authParams['client_id'], $type, $typeId);
|
||||
|
||||
// List of scopes IDs
|
||||
$scopeIds = array();
|
||||
foreach ($authParams['scopes'] as $scope)
|
||||
{
|
||||
$scopeIds[] = $scope['id'];
|
||||
}
|
||||
|
||||
// Create a new session
|
||||
$sessionId = $this->authServer->getStorage('session')->createSession($authParams['client_id'], $type, $typeId);
|
||||
|
||||
@ -207,7 +200,12 @@ class AuthCode implements GrantTypeInterface {
|
||||
$this->authServer->getStorage('session')->associateRedirectUri($sessionId, $authParams['redirect_uri']);
|
||||
|
||||
// Associate the auth code
|
||||
$this->authServer->getStorage('session')->associateAuthCode($sessionId, $authCode, time() + $this->authTokenTTL, implode(',', $scopeIds));
|
||||
$authCodeId = $this->authServer->getStorage('session')->associateAuthCode($sessionId, $authCode, time() + $this->authTokenTTL, implode(',', $scopeIds));
|
||||
|
||||
// Associate the scopes to the auth code
|
||||
foreach ($authParams['scopes'] as $scope) {
|
||||
$this->authServer->getStorage('session')->associateAuthCodeScope($authCodeId, $scope['id']);
|
||||
}
|
||||
|
||||
return $authCode;
|
||||
}
|
||||
|
@ -102,17 +102,16 @@ interface SessionInterface
|
||||
* Example SQL query:
|
||||
*
|
||||
* <code>
|
||||
* INSERT INTO oauth_session_authcodes (session_id, auth_code, auth_code_expires, scope_ids)
|
||||
* VALUE (:sessionId, :authCode, :authCodeExpires, :scopeIds)
|
||||
* INSERT INTO oauth_session_authcodes (session_id, auth_code, auth_code_expires)
|
||||
* VALUE (:sessionId, :authCode, :authCodeExpires)
|
||||
* </code>
|
||||
*
|
||||
* @param int $sessionId The session ID
|
||||
* @param string $authCode The authorization code
|
||||
* @param int $expireTime Unix timestamp of the access token expiry time
|
||||
* @param string $scopeIds Comma seperated list of scope IDs to be later associated (default = null)
|
||||
* @return void
|
||||
* @return int The auth code ID
|
||||
*/
|
||||
public function associateAuthCode($sessionId, $authCode, $expireTime, $scopeIds = null);
|
||||
public function associateAuthCode($sessionId, $authCode, $expireTime);
|
||||
|
||||
/**
|
||||
* Remove an associated authorization token from a session
|
||||
|
Loading…
x
Reference in New Issue
Block a user