2007-09-14 03:12:21 +00:00
|
|
|
<?php
|
2016-06-23 11:37:22 +12:00
|
|
|
|
|
|
|
namespace SilverStripe\Security;
|
|
|
|
|
2017-05-30 19:42:00 +12:00
|
|
|
use SilverStripe\ORM\ValidationResult;
|
2017-06-09 15:07:35 +12:00
|
|
|
use SilverStripe\Security\MemberAuthenticator\LoginHandler;
|
|
|
|
use SilverStripe\Security\MemberAuthenticator\LogoutHandler;
|
2016-06-23 11:37:22 +12:00
|
|
|
|
2007-09-14 03:12:21 +00: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 16:30:10 +12:00
|
|
|
interface Authenticator
|
2016-11-29 12:31:16 +13:00
|
|
|
{
|
2017-05-17 17:40:13 +12:00
|
|
|
|
2017-04-22 16:30:10 +12:00
|
|
|
const LOGIN = 1;
|
|
|
|
const LOGOUT = 2;
|
|
|
|
const CHANGE_PASSWORD = 4;
|
|
|
|
const RESET_PASSWORD = 8;
|
|
|
|
const CMS_LOGIN = 16;
|
2016-11-29 12:31:16 +13:00
|
|
|
|
|
|
|
/**
|
2017-04-22 16:30:10 +12:00
|
|
|
* Returns the services supported by this authenticator
|
2016-11-29 12:31:16 +13:00
|
|
|
*
|
2017-04-22 16:30:10 +12: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 12:31:16 +13:00
|
|
|
*
|
2017-04-22 16:30:10 +12:00
|
|
|
* @return int
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
2017-04-22 16:30:10 +12:00
|
|
|
public function supportedServices();
|
2016-11-29 12:31:16 +13:00
|
|
|
|
|
|
|
/**
|
2017-04-22 16:30:10 +12:00
|
|
|
* Return RequestHandler to manage the log-in process.
|
2016-11-29 12:31:16 +13:00
|
|
|
*
|
2017-05-20 16:32:25 +12:00
|
|
|
* The default URL of the RequestHandler should return the initial log-in form, any other
|
2017-04-22 16:30:10 +12: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 12:31:16 +13:00
|
|
|
*
|
2017-05-20 16:32:25 +12:00
|
|
|
* @param string $link The base link to use for this RequestHandler
|
2017-06-09 15:07:35 +12:00
|
|
|
* @return LoginHandler
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
2017-04-22 16:30:10 +12:00
|
|
|
public function getLoginHandler($link);
|
2016-11-29 12:31:16 +13:00
|
|
|
|
2017-05-20 16:32:25 +12: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
|
2017-06-09 15:07:35 +12:00
|
|
|
* @return LogoutHandler
|
2017-05-20 16:32:25 +12:00
|
|
|
*/
|
|
|
|
public function getLogOutHandler($link);
|
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
/**
|
2017-04-22 16:30:10 +12: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 12:31:16 +13:00
|
|
|
*
|
2017-04-22 16:30:10 +12:00
|
|
|
* URL-handling methods may return an array [ "Form" => (form-object) ] which can then
|
|
|
|
* be merged into a default controller.
|
|
|
|
*
|
2017-04-30 15:17:26 +12:00
|
|
|
* @param string $link The base link to use for this RequestHnadler
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
2017-04-22 16:30:10 +12:00
|
|
|
public function getChangePasswordHandler($link);
|
2017-05-17 17:40:13 +12:00
|
|
|
|
2017-05-20 16:32:25 +12:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
/**
|
2017-06-09 15:07:35 +12:00
|
|
|
* @param string $link
|
2017-05-30 19:42:00 +12:00
|
|
|
* @return mixed
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
2017-04-22 16:30:10 +12:00
|
|
|
public function getLostPasswordHandler($link);
|
2016-11-29 12:31:16 +13:00
|
|
|
|
|
|
|
/**
|
2017-04-22 16:30:10 +12:00
|
|
|
* Method to authenticate an user.
|
2016-11-29 12:31:16 +13:00
|
|
|
*
|
2017-04-22 16:30:10 +12:00
|
|
|
* @param array $data Raw data to authenticate the user.
|
2017-05-30 19:42:00 +12:00
|
|
|
* @param ValidationResult $result A validationresult which is either valid or contains the error message(s)
|
2017-04-22 16:30:10 +12:00
|
|
|
* @return Member The matched member, or null if the authentication fails
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
2017-06-09 15:07:35 +12:00
|
|
|
public function authenticate($data, &$result = null);
|
2007-09-14 03:12:21 +00:00
|
|
|
}
|