app/config/services.php: setup "oauth" using the new implementation
This commit is contained in:
parent
b3eb25d221
commit
f966cfb911
1 changed files with 14 additions and 3 deletions
|
|
@ -24,7 +24,8 @@ use Phalcon\Di\FactoryDefault,
|
|||
Phalcon\Mvc\Router;
|
||||
|
||||
use Httpcb\Auth,
|
||||
Httpcb\OAuth,
|
||||
Httpcb\OAuth\Client as OAuthClient,
|
||||
Httpcb\OAuth\Adapter\League as OAuthAdapter,
|
||||
Httpcb\Acl,
|
||||
Httpcb\Navigation,
|
||||
Httpcb\Menu;
|
||||
|
|
@ -294,8 +295,18 @@ $di->setShared('flash', function () {
|
|||
return new Phalcon\Flash\Session();
|
||||
});
|
||||
|
||||
$di->set('oauth', function() use ($config) {
|
||||
return new OAuth($config);
|
||||
$di->set('oauth', function($provider) use ($config) {
|
||||
|
||||
if (isset($config->oauth->providers->{$provider})) {
|
||||
$options = $config->oauth->providers->{$provider};
|
||||
$options = $options->toArray();
|
||||
} else {
|
||||
$options = array();
|
||||
}
|
||||
|
||||
$adapter = new OAuthAdapter($provider, $options);
|
||||
|
||||
return new OAuthClient($adapter);
|
||||
});
|
||||
|
||||
$di->set('auth', function() use ($di, $config) {
|
||||
|
|
|
|||
Reference in a new issue