datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
956 B
39 lines
956 B
7 years ago
|
<?php namespace AdamWathan\EloquentOAuth;
|
||
|
|
||
|
use SocialNorm\SocialNorm;
|
||
|
|
||
|
class OAuthManager
|
||
|
{
|
||
|
/** @var string */
|
||
|
protected $redirect;
|
||
|
|
||
|
/** @var Authenticator */
|
||
|
protected $authenticator;
|
||
|
|
||
|
/** @var SocialNorm */
|
||
|
protected $socialnorm;
|
||
|
|
||
|
public function __construct($redirect, $authenticator, $socialnorm)
|
||
|
{
|
||
|
$this->redirect = $redirect;
|
||
|
$this->authenticator = $authenticator;
|
||
|
$this->socialnorm = $socialnorm;
|
||
|
}
|
||
|
|
||
|
public function authorize($providerAlias)
|
||
|
{
|
||
|
return $this->redirect->to($this->socialnorm->authorize($providerAlias));
|
||
|
}
|
||
|
|
||
|
public function login($providerAlias, $callback = null)
|
||
|
{
|
||
|
$details = $this->socialnorm->getUser($providerAlias);
|
||
|
return $this->authenticator->login($providerAlias, $details, $callback);
|
||
|
}
|
||
|
|
||
|
public function registerProvider($alias, $provider)
|
||
|
{
|
||
|
$this->socialnorm->registerProvider($alias, $provider);
|
||
|
}
|
||
|
}
|