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.
 
 
 
 
 
 

46 lines
1.2 KiB

<?php namespace AdamWathan\EloquentOAuth;
use SocialNorm\Provider;
use SocialNorm\SocialNorm;
class OAuthManager
{
/** @var \Illuminate\Routing\Redirector */
protected $redirect;
/** @var Authenticator */
protected $authenticator;
/** @var SocialNorm */
protected $socialnorm;
public function __construct(
\Illuminate\Routing\Redirector $redirect,
Authenticator $authenticator,
SocialNorm $socialnorm)
{
$this->redirect = $redirect;
$this->authenticator = $authenticator;
$this->socialnorm = $socialnorm;
}
public function authorize(string $providerAlias)
{
return $this->redirect->to($this->socialnorm->authorize($providerAlias));
}
/**
* @param $providerAlias
* @param \Closure|null $callback
*/
public function login(string $providerAlias, $callback = null)
{
$details = $this->socialnorm->getUser($providerAlias);
return $this->authenticator->login($providerAlias, $details, $callback);
}
public function registerProvider(string $alias, Provider $provider)
{
$this->socialnorm->registerProvider($alias, $provider);
}
}