mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
44 lines
854 B
PHP
44 lines
854 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Authentication;
|
|
|
|
use Entities\Session;
|
|
|
|
class Manager
|
|
{
|
|
private $authenticator;
|
|
private $providers;
|
|
|
|
public function __construct(Authenticator $authenticator, ProvidersCollection $providers)
|
|
{
|
|
$this->authenticator = $authenticator;
|
|
$this->providers = $providers;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param \User_Adapter $user
|
|
*
|
|
* @return Session
|
|
*/
|
|
public function openAccount(\User_Adapter $user)
|
|
{
|
|
return $this->authenticator->openAccount($user);
|
|
}
|
|
|
|
/**
|
|
* Return a RedirectResponse
|
|
*/
|
|
public function authenticate(array $parameters, $provider)
|
|
{
|
|
return $this->providers
|
|
->get($provider)
|
|
->authenticate($parameters);
|
|
}
|
|
|
|
public function getProviders()
|
|
{
|
|
return $this->providers;
|
|
}
|
|
}
|