2012-07-05 17:38:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace LNCD\OAuth2server;
|
|
|
|
|
2012-07-06 17:42:50 +01:00
|
|
|
class OAuthServerClientException extends Exception {}
|
2012-07-06 16:44:07 +01:00
|
|
|
|
|
|
|
class OAuthServerUserException extends Exception {}
|
|
|
|
|
|
|
|
class OAuthServerException extends Exception {}
|
|
|
|
|
2012-07-05 17:38:58 +01:00
|
|
|
class Server
|
|
|
|
{
|
2012-07-06 17:43:33 +01:00
|
|
|
private $db = NULL;
|
2012-07-06 17:43:55 +01:00
|
|
|
|
|
|
|
private $config = array(
|
|
|
|
'response_types' => array(
|
|
|
|
'code'
|
|
|
|
),
|
|
|
|
'scope_delimeter' => ','
|
|
|
|
);
|
|
|
|
|
2012-07-06 16:44:24 +01:00
|
|
|
protected $errors = array(
|
2012-07-06 16:47:11 +01:00
|
|
|
'invalid_request' => 'The request is missing a required parameter, includes an invalid parameter value,
|
|
|
|
includes a parameter more than once, or is otherwise malformed.',
|
2012-07-06 16:44:24 +01:00
|
|
|
'unauthorized_client' => 'The client is not authorized to request an access token using this method.',
|
|
|
|
'access_denied' => 'The resource owner or authorization server denied the request.',
|
2012-07-06 16:47:11 +01:00
|
|
|
'unsupported_response_type' => 'The authorization server does not support obtaining an access token using this
|
|
|
|
method.',
|
2012-07-06 16:44:24 +01:00
|
|
|
'invalid_scope' => 'The requested scope is invalid, unknown, or malformed.',
|
2012-07-06 16:47:11 +01:00
|
|
|
'server_error' => 'The authorization server encountered an unexpected condition which prevented it from
|
|
|
|
fulfilling the request.',
|
|
|
|
'temporarily_unavailable' => 'The authorization server is currently unable to handle the request due to a
|
|
|
|
temporary overloading or maintenance of the server.'
|
2012-07-06 16:44:24 +01:00
|
|
|
);
|
2012-07-05 17:38:58 +01:00
|
|
|
|
|
|
|
public function __construct()
|
2012-07-06 17:43:55 +01:00
|
|
|
public function __construct(array $options)
|
|
|
|
{
|
|
|
|
$this->options = array_merge($this->config, $options);
|
|
|
|
}
|
|
|
|
|
2012-07-06 17:43:33 +01:00
|
|
|
public function registerDbAbstractor(object $db)
|
2012-07-05 17:38:58 +01:00
|
|
|
{
|
|
|
|
|
2012-07-06 17:43:33 +01:00
|
|
|
$this->db = $db;
|
2012-07-05 17:38:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function registerDbAbstractor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|