Compare commits

..

14 Commits
0.3.2 ... 0.3.5

Author SHA1 Message Date
Alex Bilbie
41d8a1efa3 Merge branch 'release/0.3.5' 2012-12-12 11:44:56 +00:00
Alex Bilbie
4928221b49 Version bump 2012-12-12 11:44:51 +00:00
Alex Bilbie
8131d5be90 Merge branch 'hotfix/resourceConfig' into develop 2012-12-12 11:44:04 +00:00
Alex Bilbie
a948335e45 Merge branch 'hotfix/resourceConfig' 2012-12-12 11:43:11 +00:00
Alex Bilbie
aa978d3581 Fix variable name 2012-12-12 11:43:01 +00:00
Alex Bilbie
b1d91f33cf Merge branch 'release/0.3.4' into develop 2012-12-11 15:33:20 +00:00
Alex Bilbie
1be25955d6 Merge branch 'release/0.3.4' 2012-12-11 15:33:05 +00:00
Alex Bilbie
3365953257 Version bump 2012-12-11 15:32:27 +00:00
Alex Bilbie
302bf1f70d Clean trailing whitespace 2012-12-11 15:31:42 +00:00
Alex Bilbie
6553fb3f22 Return client details 2012-12-11 12:09:56 +00:00
Alex Bilbie
fdfe80289a Merge branch 'release/0.3.3'. Release version 0.3.3
Conflicts:
	composer.json
2012-12-10 21:31:58 +00:00
Alex Bilbie
0ed6674ceb Version bump. Fixed website 2012-12-10 21:31:08 +00:00
Alex Bilbie
912cd3fa25 Changed session stage to 'requested' as per enum 2012-12-10 21:19:11 +00:00
Alex Bilbie
b2188514d9 Merge branch 'release/0.3' into develop 2012-10-14 17:21:04 +01:00
3 changed files with 42 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "lncd/oauth2",
"description": "OAuth 2.0 Framework",
"version": "0.3.2",
"version": "0.3.5",
"homepage": "https://github.com/lncd/OAuth2",
"license": "MIT",
"require": {
@@ -29,7 +29,7 @@
{
"name": "Alex Bilbie",
"email": "hello@alexbilbie.com",
"homepage": "http://www.httpster.org",
"homepage": "http://www.alexbilbie.com",
"role": "Developer"
}
],

View File

@@ -41,7 +41,7 @@ class Server
private $_responseTypes = array(
'code'
);
/**
* Supported grant types
* @var array
@@ -69,9 +69,9 @@ class Server
/**
* Error codes.
*
*
* To provide i8ln errors just overwrite the keys
*
*
* @var array
*/
public $errors = array(
@@ -89,7 +89,7 @@ class Server
/**
* Constructor
*
*
* @access public
* @param array $options Optional list of options to overwrite the defaults
* @return void
@@ -103,7 +103,7 @@ class Server
/**
* Register a database abstrator class
*
*
* @access public
* @param object $db A class that implements OAuth2ServerDatabase
* @return void
@@ -115,7 +115,7 @@ class Server
/**
* Check client authorise parameters
*
*
* @access public
* @param array $authParams Optional array of parsed $_GET keys
* @return array Authorise request parameters
@@ -132,7 +132,7 @@ class Server
} else {
$params['client_id'] = (isset($authParams['client_id'])) ?
$authParams['client_id'] :
$authParams['client_id'] :
$_GET['client_id'];
}
@@ -163,6 +163,8 @@ class Server
throw new ClientException($this->errors['invalid_client'], 8);
}
$params['client_details'] = $clientDetails;
// Response type
if ( ! isset($authParams['response_type']) && ! isset($_GET['response_type'])) {
@@ -214,7 +216,7 @@ class Server
'getScope',
$scope
);
if ($scopeDetails === false) {
throw new ClientException(sprintf($this->errors['invalid_scope'], $scope), 4);
@@ -231,7 +233,7 @@ class Server
/**
* Parse a new authorise request
*
*
* @param string $type The session owner's type
* @param string $typeId The session owner's ID
* @param array $authoriseParams The authorise request $_GET parameters
@@ -249,10 +251,10 @@ class Server
// Create the new auth code
$authCode = $this->newAuthCode(
$authoriseParams['client_id'],
$authoriseParams['client_id'],
'user',
$typeId,
$authoriseParams['redirect_uri'],
$authoriseParams['redirect_uri'],
$authoriseParams['scopes']
);
@@ -261,9 +263,9 @@ class Server
/**
* Generate a unique code
*
*
* Generate a unique code for an authorisation code, or token
*
*
* @return string A unique code
*/
private function generateCode()
@@ -273,7 +275,7 @@ class Server
/**
* Create a new authorisation code
*
*
* @param string $clientId The client ID
* @param string $type The type of the owner of the session
* @param string $typeId The session owner's ID
@@ -286,7 +288,7 @@ class Server
{
$authCode = $this->generateCode();
// If an access token exists then update the existing session with the
// If an access token exists then update the existing session with the
// new authorisation code otherwise create a new session
if ($accessToken !== null) {
@@ -297,15 +299,15 @@ class Server
$typeId,
$authCode,
$accessToken,
'request'
'requested'
);
} else {
// Delete any existing sessions just to be sure
$this->_dbCall('deleteSession', $clientId, $type, $typeId);
// Create a new session
// Create a new session
$sessionId = $this->_dbCall(
'newSession',
$clientId,
@@ -315,9 +317,9 @@ class Server
$authCode,
null,
null,
'request'
'requested'
);
// Add the scopes
foreach ($scopes as $key => $scope) {
@@ -330,17 +332,17 @@ class Server
}
}
return $authCode;
}
/**
* Issue an access token
*
*
* @access public
*
*
* @param array $authParams Optional array of parsed $_POST keys
*
*
* @return array Authorise request parameters
*/
public function issueAccessToken($authParams = null)
@@ -367,10 +369,10 @@ class Server
switch ($params['grant_type'])
{
case 'authorization_code': // Authorization code grant
return $this->completeAuthCodeGrant($authParams, $params);
break;
break;
case 'refresh_token': // Refresh token
case 'password': // Resource owner password credentials grant
@@ -383,12 +385,12 @@ class Server
/**
* Complete the authorisation code grant
*
*
* @access private
*
*
* @param array $authParams Array of parsed $_POST keys
* @param array $params Generated parameters from issueAccessToken()
*
*
* @return array Authorise request parameters
*/
private function completeAuthCodeGrant($authParams = array(), $params = array())
@@ -436,7 +438,7 @@ class Server
$clientDetails = $this->_dbCall(
'validateClient',
$params['client_id'],
$params['client_secret'],
$params['client_secret'],
$params['redirect_uri']
);
@@ -470,7 +472,7 @@ class Server
if ( ! $session) {
throw new ClientException(sprintf($this->errors['invalid_grant'], 'code'), 9);
} else {
// A session ID was returned so update it with an access token,
@@ -508,16 +510,16 @@ class Server
/**
* Generates the redirect uri with appended params
*
*
* @param string $redirectUri The redirect URI
* @param array $params The parameters to be appended to the URL
* @param string $query_delimeter The query string delimiter (default: ?)
*
*
* @return string The updated redirect URI
*/
public function redirectUri($redirectUri, $params = array(), $queryDelimeter = '?')
{
if (strstr($redirectUri, $queryDelimeter)) {
$redirectUri = $redirectUri . '&' . http_build_query($params);
@@ -527,14 +529,14 @@ class Server
$redirectUri = $redirectUri . $queryDelimeter . http_build_query($params);
}
return $redirectUri;
}
/**
* Call database methods from the abstractor
*
*
* @return mixed The query result
*/
private function _dbCall()

View File

@@ -75,7 +75,7 @@ class Server
public function __construct($options = null)
{
if ($options !== null) {
$this->config = array_merge($this->config, $options);
$this->_config = array_merge($this->_config, $options);
}
}