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.
38 lines
1.1 KiB
38 lines
1.1 KiB
6 years ago
|
<?php namespace AdamWathan\EloquentOAuth;
|
||
|
|
||
|
class OAuthManager
|
||
|
{
|
||
|
protected $redirect;
|
||
|
protected $authenticator;
|
||
|
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, $remember = false);
|
||
|
}
|
||
|
|
||
|
public function loginForever($providerAlias, $callback = null)
|
||
|
{
|
||
|
$details = $this->socialnorm->getUser($providerAlias);
|
||
|
return $this->authenticator->login($providerAlias, $details, $callback, $remember = true);
|
||
|
}
|
||
|
|
||
|
public function registerProvider($alias, $provider)
|
||
|
{
|
||
|
$this->socialnorm->registerProvider($alias, $provider);
|
||
|
}
|
||
|
}
|