Files
Phraseanet/lib/Alchemy/Phrasea/Authentication/Provider/ProviderInterface.php
jygaulier 7e7435469d PHRAS-2995_phr-as-auth-idp-BIS (#4180)
* WIP ; allow multiple instances of some auth clients (migrate conf) ; add ps-oauth ; remove google+

* WIP ; fix ps-oauth ; fix tests

* WIP ; add api-auth to extra_hosts

* WIP ; fix yaml syntax error

* WIP ; fix yaml syntax error ; better conf sample

* WIP ; add "everyone-group"

* WIP ; add the provider-id in session

* WIP ; add getOptions() to providers (so phr/expose can filter providers)

* WIP ; add auto-logout option so logout from phr also logouts from ps-auth

* connect to expose using IDP from connected user

* WIP ; auto-logout redirects to phr home

* unnecessary session var

* unused

* fix

* catch some error

* fix navigation in train thumbnail

* update file version

* pass params in session to have constant redirect_uri ; add debug

* invalidate session --> parade test ok

* cleanup
2022-12-01 16:27:54 +01:00

110 lines
2.7 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Authentication\Provider;
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Exception\RuntimeException;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGenerator;
interface ProviderInterface
{
/**
* Returns the unique identifier for the provider (first-level key in conf)
*
* Allowed characters are a-z and - (minus).
*
* @return string
*/
public function getId();
/**
* Returns an UTF-8 name for the provider.
*
* @return string
*/
public function getName();
/**
* Redirects to the actual authentication provider
*
* @param array $params
*
* @return RedirectResponse
*/
public function authenticate(array $params);
/**
* Logout from the provider, removes the token if possible
*
* @throws RuntimeException In case logout fails.
*/
public function logout();
/**
* This method is called on provider callback, whenever the auth was
* successful or failure.
*
* @param Request $request
*
* @throws NotAuthenticatedException In case the authentication failed.
*/
public function onCallback(Request $request);
/**
* Returns the identity
*
* @return Identity
*
* @throws NotAuthenticatedException In case the provider is not connected
*/
public function getIdentity();
/**
* Returns a Token
*
* @return Token
*
* @throws NotAuthenticatedException In case the provider is not connected
*/
public function getToken();
/**
* Get an URI representing the provider
*
* @return string
*/
public function getIconURI();
/**
* Returns an array of templates related to the provided Identity
*
* @param Identity $identity
*
* @return array
*/
public function getTemplates(Identity $identity);
/**
* Creates a provider
*
* @param UrlGenerator $generator
* @param SessionInterface $session
* @param array $options
*/
public static function create(UrlGenerator $generator, SessionInterface $session, array $options);
}