-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ca2c33
commit 6809be6
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* Arikaim | ||
* | ||
* @link http://www.arikaim.com | ||
* @copyright Copyright (c) 2017-2018 Konstantin Atanasov <info@arikaim.com> | ||
* @license http://www.arikaim.com/license.html | ||
* | ||
*/ | ||
namespace Arikaim\Modules\Oauth_Client; | ||
|
||
use Arikaim\Core\Utils\Utils; | ||
use Arikaim\Core\Module\Module; | ||
|
||
class OauthClient extends Module | ||
{ | ||
private $provider; | ||
|
||
public function __construct() | ||
{ | ||
$this->provider = null; | ||
// module details | ||
$this->setServiceName('oauth-client'); | ||
$this->setBootable(false); | ||
} | ||
|
||
public function __call($method, $args) | ||
{ | ||
return Utils::call($this->provider,$method,$args); | ||
} | ||
|
||
public function create($provider_class_name = null, array $options = [], array $collaborators = []) | ||
{ | ||
if ($provider_class_name == null || empty($provider_class_name) == true) { | ||
$provider_class_name = "League\OAuth2\Client\Provider\GenericProvider"; | ||
} | ||
|
||
$this->provider = new $provider_class_name($options,$collaborators); | ||
return is_object($this->provider); | ||
} | ||
|
||
public function getProvider() | ||
{ | ||
return $this->provider; | ||
} | ||
|
||
public function test() | ||
{ | ||
try { | ||
$test_options = ['urlAuthorize' => '*','urlAccessToken' => '*', '','urlResourceOwnerDetails' => '*']; | ||
$result = $this->create(null,$test_options); | ||
$this->provider = null; | ||
} catch(\Exception $e) { | ||
$this->error = $e->getMessage(); | ||
return false; | ||
} | ||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "arikaim/oauth-client-module", | ||
"description": "Arikam Oauth Client Module", | ||
"keywords": ["Module","OAuth","Arikaim Oauth client module"], | ||
"type": "arikaim-module", | ||
"license": "GPL-3.0-or-later", | ||
"authors": [{ | ||
"name": "Konstantin Atanasov", | ||
"email": "info@arikaim.com", | ||
"homepage": "http://arikaim.com" | ||
}], | ||
"require": { | ||
"php": ">=5.6.0", | ||
"arikaim/installer": "*", | ||
"league/oauth2-client": "^2.3" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.0-dev" | ||
}, | ||
"path": "oauth_client" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"title": "OAuth Client", | ||
"version": "1.0", | ||
"class": "OauthClient", | ||
"description": "OAuth2 client.", | ||
"requires": [ | ||
"league/oauth2-client" | ||
], | ||
"help": { | ||
"url": "http://oauth2-client.thephpleague.com/" | ||
}, | ||
"type": "module" | ||
} |