1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SilverStripe\MFA\Tests\Stub\Null; |
4
|
|
|
|
5
|
|
|
use SilverStripe\Control\HTTPRequest; |
6
|
|
|
use SilverStripe\Dev\TestOnly; |
7
|
|
|
use SilverStripe\MFA\Method\Handler\VerifyHandlerInterface; |
8
|
|
|
use SilverStripe\MFA\Model\RegisteredMethod; |
9
|
|
|
use SilverStripe\MFA\State\Result; |
10
|
|
|
use SilverStripe\MFA\Store\StoreInterface; |
11
|
|
|
|
12
|
|
|
class VerifyHandler implements VerifyHandlerInterface, TestOnly |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Stores any data required to handle a login process with a method, and returns relevant state to be applied to the |
16
|
|
|
* front-end application managing the process. |
17
|
|
|
* |
18
|
|
|
* @param StoreInterface $store An object that hold session data (and the Member) that can be mutated |
19
|
|
|
* @param RegisteredMethod $method The RegisteredMethod instance that is being verified |
20
|
|
|
* @return array Props to be passed to a front-end component |
21
|
|
|
*/ |
22
|
|
|
public function start(StoreInterface $store, RegisteredMethod $method): array |
23
|
|
|
{ |
24
|
|
|
// TODO: Implement start() method. |
25
|
|
|
} |
|
|
|
|
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Verify the request has provided the right information to verify the member that aligns with any sessions state |
29
|
|
|
* that may have been set prior |
30
|
|
|
* |
31
|
|
|
* @param HTTPRequest $request |
32
|
|
|
* @param StoreInterface $store |
33
|
|
|
* @param RegisteredMethod $registeredMethod The RegisteredMethod instance that is being verified |
34
|
|
|
* @return Result |
35
|
|
|
*/ |
36
|
|
|
public function verify(HTTPRequest $request, StoreInterface $store, RegisteredMethod $registeredMethod): Result |
37
|
|
|
{ |
38
|
|
|
// TODO: Implement verify() method. |
39
|
|
|
} |
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Get the key that a React UI component is registered under (with @silverstripe/react-injector on the front-end) |
43
|
|
|
* |
44
|
|
|
* @return string |
45
|
|
|
*/ |
46
|
|
|
public function getComponent(): string |
47
|
|
|
{ |
48
|
|
|
// TODO: Implement getComponent() method. |
49
|
|
|
} |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: