-
Notifications
You must be signed in to change notification settings - Fork 24
/
MethodInterface.php
74 lines (63 loc) · 1.98 KB
/
MethodInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
declare(strict_types=1);
namespace SilverStripe\MFA\Method;
use SilverStripe\MFA\Method\Handler\VerifyHandlerInterface;
use SilverStripe\MFA\Method\Handler\RegisterHandlerInterface;
/**
* Defines an Authentication Method, which serves as an additional factor for authentication beyond the standard
* username / password method.
*/
interface MethodInterface
{
/**
* Provide a localised name for this MFA Method.
*
* eg. "Authenticator app"
*
* @return string
*/
public function getName(): string;
/**
* Get a URL segment for this method. This will be used in URL paths for performing authentication by this method
*
* @return string
*/
public function getURLSegment(): string;
/**
* Return the VerifyHandler that is used to start and check verification attempts with this method
*
* @return VerifyHandlerInterface
*/
public function getVerifyHandler(): VerifyHandlerInterface;
/**
* Return the RegisterHandler that is used to perform registrations with this method
*
* @return RegisterHandlerInterface
*/
public function getRegisterHandler(): RegisterHandlerInterface;
/**
* Return a URL to an image to be used as a thumbnail in the MFA login/registration grid for all MFA methods
*
* @return string
*/
public function getThumbnail(): string;
/**
* Leverage the Requirements API to ensure client requirements are included. This is called just after the base
* module requirements are specified
*
* @return void
*/
public function applyRequirements(): void;
/**
* Returns whether the method is available to be used from a backend perspective.
*
* @return bool
*/
public function isAvailable(): bool;
/**
* If not available to be used, provide a message to display on the frontend to explain why.
*
* @return string
*/
public function getUnavailableMessage(): string;
}