2007-09-14 05:12:21 +02:00
|
|
|
<?php
|
2016-06-23 01:37:22 +02:00
|
|
|
|
|
|
|
namespace SilverStripe\Security;
|
|
|
|
|
2017-05-17 07:40:13 +02:00
|
|
|
use SilverStripe\Core\Config\Configurable;
|
|
|
|
use SilverStripe\Core\Extensible;
|
|
|
|
use SilverStripe\Core\Injector\Injectable;
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Forms\Form;
|
2016-06-23 01:37:22 +02:00
|
|
|
|
2007-09-14 05:12:21 +02:00
|
|
|
/**
|
|
|
|
* Abstract base class for an authentication method
|
|
|
|
*
|
|
|
|
* This class is used as a base class for the different authentication
|
|
|
|
* methods like {@link MemberAuthenticator} or {@link OpenIDAuthenticator}.
|
|
|
|
*
|
|
|
|
* @author Markus Lanthaler <markus@silverstripe.com>
|
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
interface Authenticator
|
2016-11-29 00:31:16 +01:00
|
|
|
{
|
2017-05-17 07:40:13 +02:00
|
|
|
|
2017-04-22 06:30:10 +02:00
|
|
|
const LOGIN = 1;
|
|
|
|
const LOGOUT = 2;
|
|
|
|
const CHANGE_PASSWORD = 4;
|
|
|
|
const RESET_PASSWORD = 8;
|
|
|
|
const CMS_LOGIN = 16;
|
2016-11-29 00:31:16 +01:00
|
|
|
|
|
|
|
/**
|
2017-04-22 06:30:10 +02:00
|
|
|
* Returns the services supported by this authenticator
|
2016-11-29 00:31:16 +01:00
|
|
|
*
|
2017-04-22 06:30:10 +02:00
|
|
|
* The number should be a bitwise-OR of 1 or more of the following constants:
|
|
|
|
* Authenticator::LOGIN, Authenticator::LOGOUT, Authenticator::CHANGE_PASSWORD,
|
|
|
|
* Authenticator::RESET_PASSWORD, or Authenticator::CMS_LOGIN
|
2016-11-29 00:31:16 +01:00
|
|
|
*
|
2017-04-22 06:30:10 +02:00
|
|
|
* @return int
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
public function supportedServices();
|
2016-11-29 00:31:16 +01:00
|
|
|
|
|
|
|
/**
|
2017-04-22 06:30:10 +02:00
|
|
|
* Return RequestHandler to manage the log-in process.
|
2016-11-29 00:31:16 +01:00
|
|
|
*
|
2017-05-20 06:32:25 +02:00
|
|
|
* The default URL of the RequestHandler should return the initial log-in form, any other
|
2017-04-22 06:30:10 +02:00
|
|
|
* URL may be added for other steps & processing.
|
|
|
|
*
|
|
|
|
* URL-handling methods may return an array [ "Form" => (form-object) ] which can then
|
|
|
|
* be merged into a default controller.
|
2016-11-29 00:31:16 +01:00
|
|
|
*
|
2017-05-20 06:32:25 +02:00
|
|
|
* @param string $link The base link to use for this RequestHandler
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
public function getLoginHandler($link);
|
2016-11-29 00:31:16 +01:00
|
|
|
|
2017-05-20 06:32:25 +02:00
|
|
|
/**
|
|
|
|
* Return the RequestHandler to manage the log-out process.
|
|
|
|
*
|
|
|
|
* The default URL of the RequestHandler should log the user out immediately and destroy the session.
|
|
|
|
*
|
|
|
|
* @param string $link The base link to use for this RequestHandler
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getLogOutHandler($link);
|
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
2017-04-22 06:30:10 +02:00
|
|
|
* Return RequestHandler to manage the change-password process.
|
|
|
|
*
|
|
|
|
* The default URL of the RequetHandler should return the initial change-password form,
|
|
|
|
* any other URL may be added for other steps & processing.
|
2016-11-29 00:31:16 +01:00
|
|
|
*
|
2017-04-22 06:30:10 +02:00
|
|
|
* URL-handling methods may return an array [ "Form" => (form-object) ] which can then
|
|
|
|
* be merged into a default controller.
|
|
|
|
*
|
2017-04-30 05:17:26 +02:00
|
|
|
* @param string $link The base link to use for this RequestHnadler
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
public function getChangePasswordHandler($link);
|
2017-05-17 07:40:13 +02:00
|
|
|
|
2017-05-20 06:32:25 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
2017-04-22 06:30:10 +02:00
|
|
|
* @todo
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
public function getLostPasswordHandler($link);
|
2016-11-29 00:31:16 +01:00
|
|
|
|
|
|
|
/**
|
2017-04-22 06:30:10 +02:00
|
|
|
* Method to authenticate an user.
|
2016-11-29 00:31:16 +01:00
|
|
|
*
|
2017-04-22 06:30:10 +02:00
|
|
|
* @param array $data Raw data to authenticate the user.
|
|
|
|
* @param string $message A variable to return an error message if authentication fails
|
|
|
|
* @return Member The matched member, or null if the authentication fails
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
public function authenticate($data, &$message);
|
2016-11-29 00:31:16 +01:00
|
|
|
|
|
|
|
/**
|
2017-04-22 06:30:10 +02:00
|
|
|
* Return the keys that should be passed to authenticate()
|
|
|
|
* @return array
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
2017-04-22 06:30:10 +02:00
|
|
|
// public function getAuthenticateFields();
|
2007-09-14 05:12:21 +02:00
|
|
|
}
|