mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-18 17:42:54 +05:30
Version bump
This commit is contained in:
commit
a5b83c00bd
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "lncd/oauth2",
|
||||
"description": "OAuth 2.0 Framework",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"homepage": "https://github.com/lncd/OAuth2",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
|
@ -20,7 +20,7 @@ CREATE TABLE `client_endpoints` (
|
||||
-- Create syntax for TABLE 'oauth_sessions'
|
||||
CREATE TABLE `oauth_sessions` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`client_id` varchar(32) NOT NULL DEFAULT '',
|
||||
`client_id` varchar(40) NOT NULL DEFAULT '',
|
||||
`redirect_uri` varchar(250) NOT NULL DEFAULT '',
|
||||
`owner_type` enum('user','client') NOT NULL DEFAULT 'user',
|
||||
`owner_id` varchar(255) DEFAULT NULL,
|
||||
|
@ -26,10 +26,22 @@ interface Database
|
||||
* $redirectUri
|
||||
* </code>
|
||||
*
|
||||
* Response:
|
||||
*
|
||||
* <code>
|
||||
* Array
|
||||
* (
|
||||
* [client_id] => (string) The client ID
|
||||
* [client secret] => (string) The client secret
|
||||
* [redirect_uri] => (string) The redirect URI used in this request
|
||||
* [name] => (string) The name of the client
|
||||
* )
|
||||
* </code>
|
||||
*
|
||||
* @param string $clientId The client's ID
|
||||
* @param string $clientSecret The client's secret (default = "null")
|
||||
* @param string $redirectUri The client's redirect URI (default = "null")
|
||||
* @return [type] [description]
|
||||
* @return bool|array Returns false if the validation fails, array on success
|
||||
*/
|
||||
public function validateClient(
|
||||
$clientId,
|
||||
@ -56,7 +68,7 @@ interface Database
|
||||
* @param string $authCode The authorisation code (default = "null")
|
||||
* @param string $accessToken The access token (default = "null")
|
||||
* @param string $stage The stage of the session (default ="request")
|
||||
* @return [type] [description]
|
||||
* @return int The session ID
|
||||
*/
|
||||
public function newSession(
|
||||
$clientId,
|
||||
@ -105,7 +117,7 @@ interface Database
|
||||
* @param string $clientId The client ID
|
||||
* @param string $type The session owner's type
|
||||
* @param string $typeId The session owner's ID
|
||||
* @return [type] [description]
|
||||
* @return void
|
||||
*/
|
||||
public function deleteSession(
|
||||
$clientId,
|
||||
|
@ -37,8 +37,8 @@ interface Database
|
||||
* Database query:
|
||||
*
|
||||
* <code>
|
||||
* SELECT scope FROM oauth_session_scopes WHERE access_token =
|
||||
* '291dca1c74900f5f252de351e0105aa3fc91b90b'
|
||||
* SELECT scope FROM oauth_session_scopes WHERE session_id =
|
||||
* $sessionId
|
||||
* </code>
|
||||
*
|
||||
* Response:
|
||||
|
@ -23,11 +23,7 @@ class OAuthdb implements Database
|
||||
'description' => 'test'
|
||||
));
|
||||
|
||||
public function validateClient(
|
||||
$clientId,
|
||||
$clientSecret = null,
|
||||
$redirectUri = null
|
||||
)
|
||||
public function validateClient($clientId, $clientSecret = null, $redirectUri = null)
|
||||
{
|
||||
if ($clientId !== $this->clients[0]['client_id'])
|
||||
{
|
||||
@ -47,16 +43,7 @@ class OAuthdb implements Database
|
||||
return $this->clients[0];
|
||||
}
|
||||
|
||||
public function newSession(
|
||||
$clientId,
|
||||
$redirectUri,
|
||||
$type = 'user',
|
||||
$typeId = null,
|
||||
$authCode = null,
|
||||
$accessToken = null,
|
||||
$accessTokenExpire = null,
|
||||
$stage = 'requested'
|
||||
)
|
||||
public function newSession($clientId, $redirectUri, $type = 'user', $typeId = null, $authCode = null, $accessToken = null, $accessTokenExpire = null, $stage = 'requested')
|
||||
{
|
||||
$id = count($this->sessions);
|
||||
|
||||
@ -75,16 +62,10 @@ class OAuthdb implements Database
|
||||
$this->sessions_client_type_id[$clientId . ':' . $type . ':' . $typeId] = $id;
|
||||
$this->sessions_code[$clientId . ':' . $redirectUri . ':' . $authCode] = $id;
|
||||
|
||||
return true;
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function updateSession(
|
||||
$sessionId,
|
||||
$authCode = null,
|
||||
$accessToken = null,
|
||||
$accessTokenExpire = null,
|
||||
$stage = 'requested'
|
||||
)
|
||||
public function updateSession($sessionId, $authCode = null, $accessToken = null, $accessTokenExpire = null, $stage = 'requested')
|
||||
{
|
||||
$this->sessions[$sessionId]['auth_code'] = $authCode;
|
||||
$this->sessions[$sessionId]['access_token'] = $accessToken;
|
||||
@ -94,11 +75,7 @@ class OAuthdb implements Database
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteSession(
|
||||
$clientId,
|
||||
$type,
|
||||
$typeId
|
||||
)
|
||||
public function deleteSession($clientId, $type, $typeId)
|
||||
{
|
||||
$key = $clientId . ':' . $type . ':' . $typeId;
|
||||
if (isset($this->sessions_client_type_id[$key]))
|
||||
@ -108,11 +85,7 @@ class OAuthdb implements Database
|
||||
return true;
|
||||
}
|
||||
|
||||
public function validateAuthCode(
|
||||
$clientId,
|
||||
$redirectUri,
|
||||
$authCode
|
||||
)
|
||||
public function validateAuthCode($clientId, $redirectUri, $authCode)
|
||||
{
|
||||
$key = $clientId . ':' . $redirectUri . ':' . $authCode;
|
||||
|
||||
@ -124,11 +97,7 @@ class OAuthdb implements Database
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasSession(
|
||||
$type,
|
||||
$typeId,
|
||||
$clientId
|
||||
)
|
||||
public function hasSession($type, $typeId, $clientId)
|
||||
{
|
||||
die('not implemented hasSession');
|
||||
}
|
||||
@ -151,10 +120,7 @@ class OAuthdb implements Database
|
||||
die('not implemented setAccessToken');
|
||||
}
|
||||
|
||||
public function addSessionScope(
|
||||
$sessionId,
|
||||
$scope
|
||||
)
|
||||
public function addSessionScope($sessionId, $scope)
|
||||
{
|
||||
if ( ! isset($this->session_scopes[$sessionId]))
|
||||
{
|
||||
@ -176,10 +142,7 @@ class OAuthdb implements Database
|
||||
return $this->scopes[$scope];
|
||||
}
|
||||
|
||||
public function updateSessionScopeAccessToken(
|
||||
$sessionId,
|
||||
$accessToken
|
||||
)
|
||||
public function updateSessionScopeAccessToken($sessionId, $accessToken)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user