mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 13:39:48 +05:30
Fixes and cleanup
Signed-off-by: Alex Bilbie <alex@alexbilbie.com>
This commit is contained in:
parent
ec191cffe1
commit
bef7a212e3
@ -1,43 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Oauth2\Client;
|
namespace OAuth2\Client;
|
||||||
|
|
||||||
include('Exception.php');
|
include_once('Exception.php');
|
||||||
include('Token.php');
|
|
||||||
include('IDP.php');
|
|
||||||
|
|
||||||
/**
|
class Client
|
||||||
* OAuth2.0
|
|
||||||
*
|
|
||||||
* @author Phil Sturgeon < @philsturgeon >
|
|
||||||
*/
|
|
||||||
class Provider
|
|
||||||
{
|
{
|
||||||
|
public function __construct($name, array $options = null)
|
||||||
/**
|
|
||||||
* Create a new provider client.
|
|
||||||
*
|
|
||||||
* @param string provider name
|
|
||||||
* @param array provider options
|
|
||||||
* @return OAuth_Provider
|
|
||||||
*/
|
|
||||||
public function __construct($name, array $options = NULL)
|
|
||||||
{
|
{
|
||||||
$name = ucfirst(strtolower($name));
|
if ( ! class_exists($name)) {
|
||||||
|
|
||||||
$fileName = 'Provider/'.$name.'.php';
|
throw new OAuth2\Client\Exception('There is no identity provider called: '.$name);
|
||||||
|
|
||||||
if (file_exists($fileName)) {
|
|
||||||
|
|
||||||
require_once $fileName;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
throw new Exception('There is no provider configuration file for '.$name);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new $name($options);
|
return new $name($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Oauth2\Client;
|
namespace OAuth2\Client;
|
||||||
|
|
||||||
class Exception extends \Exception
|
class Exception extends \Exception
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user