1 | <?php |
||
9 | class AuthFactory extends \Object { |
||
10 | |||
11 | /** |
||
12 | * Returns a new instance of an authentication mechanism depending on the configured type. |
||
13 | * @return IAuth an instance of an authentication mechanism |
||
14 | * @throws RestSystemException |
||
15 | */ |
||
16 | public static function createAuth() { |
||
19 | |||
20 | /** |
||
21 | * Generates an encrypted random token. |
||
22 | * @param \Member $user |
||
23 | * @throws \PasswordEncryptor_NotFoundException |
||
24 | * @return string |
||
25 | */ |
||
26 | public static function generate_token($user) { |
||
34 | |||
35 | /** |
||
36 | * Returns the token from the request. |
||
37 | * |
||
38 | * Silverstripe doesn't include Authorization header in its requests. We should check it, because we can use the |
||
39 | * mechanism in the tests. |
||
40 | * @param \SS_HTTPRequest $request |
||
41 | * @return String the token |
||
42 | * @throws \Exception |
||
43 | */ |
||
44 | public static function get_token($request) { |
||
63 | } |
||
64 |