mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	| @@ -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 | ||||||
| { | { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user