silverstripe-framework/src/Security/Authenticator.php

90 lines
2.6 KiB
PHP
Raw Normal View History

<?php
2016-06-23 01:37:22 +02:00
namespace SilverStripe\Security;
use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Control\Controller;
use SilverStripe\Forms\Form;
2016-06-23 01:37:22 +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>
*/
interface Authenticator
2016-11-29 00:31:16 +01: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
/**
* Returns the services supported by this authenticator
2016-11-29 00:31:16 +01: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
*
* @return int
2016-11-29 00:31:16 +01:00
*/
public function supportedServices();
2016-11-29 00:31:16 +01:00
/**
* Return RequestHandler to manage the log-in process.
2016-11-29 00:31:16 +01:00
*
* The default URL of the RequetHandler should return the initial log-in form, any other
* 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
*
* @param $link The base link to use for this RequestHnadler
2016-11-29 00:31:16 +01:00
*/
public function getLoginHandler($link);
2016-11-29 00:31:16 +01:00
/**
* @todo
2016-11-29 00:31:16 +01:00
*/
public function getCMSLoginHandler($link);
2016-11-29 00:31:16 +01: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
*
* URL-handling methods may return an array [ "Form" => (form-object) ] which can then
* be merged into a default controller.
*
* @param $link The base link to use for this RequestHnadler
2016-11-29 00:31:16 +01:00
*/
public function getChangePasswordHandler($link);
2016-11-29 00:31:16 +01:00
/**
* @todo
2016-11-29 00:31:16 +01:00
*/
public function getLostPasswordHandler($link);
2016-11-29 00:31:16 +01:00
/**
* Method to authenticate an user.
2016-11-29 00:31:16 +01: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
*/
public function authenticate($data, &$message);
2016-11-29 00:31:16 +01:00
/**
* Return the keys that should be passed to authenticate()
* @return array
2016-11-29 00:31:16 +01:00
*/
// public function getAuthenticateFields();
}