1 | <?php |
||
13 | final class TokenController extends BaseController |
||
14 | { |
||
15 | /** |
||
16 | * @param Request $request |
||
17 | * @param int $tokenExpire |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | protected static function createToken(Request $request, $tokenExpire = 3600) |
||
33 | |||
34 | /** |
||
35 | * @param string $token |
||
36 | * @param array $whiteList |
||
37 | * |
||
38 | * @return bool |
||
39 | */ |
||
40 | public static function validateToken($token, $whiteList = []) |
||
49 | |||
50 | /** |
||
51 | * @api {post} /token Получение токена |
||
52 | * @apiName CreateToken |
||
53 | * @apiGroup Token |
||
54 | * |
||
55 | * @apiDescription Метод для получения авторизационного токена. Он отправляется в заголовке запроса: |
||
56 | * |
||
57 | * Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
||
58 | * |
||
59 | * @apiParam {String} username Логин |
||
60 | * @apiParam {String} password Пароль |
||
61 | * |
||
62 | * @apiParamExample {json} Пример запроса: |
||
63 | * { |
||
64 | * "data":{ |
||
65 | * "attributes":{ |
||
66 | * "username":"[email protected]", |
||
67 | * "password": "qwerty" |
||
68 | * } |
||
69 | * } |
||
70 | * } |
||
71 | * |
||
72 | * @apiSuccessExample {json} Успешно (200) |
||
73 | * HTTP/1.1 200 OK |
||
74 | * { |
||
75 | * "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOmZhbHNlLCJhdWQiOiJza2VsZXRvbi5kZXYiLCJpYXQiOjE0NzY0Mjk4NjksImV4cCI6MTQ3NjQzMzQ2OX0.NJn_-lK28kEZyZqygLr6B-FZ2zC2-1unStayTGicP5g", |
||
76 | * "user": { |
||
77 | * "id": 1, |
||
78 | * "email": "[email protected]", |
||
79 | * "full_name": "Тестовый пользоатель", |
||
80 | * "role_id": "1", |
||
81 | * "created_by": 0, |
||
82 | * "updated_by": null, |
||
83 | * "created_at": "2016-07-24 14:07:54", |
||
84 | * "updated_at": "2016-10-14 10:24:29", |
||
85 | * "deleted_at": null, |
||
86 | * "status": 1 |
||
87 | * } |
||
88 | * } |
||
89 | * |
||
90 | * @apiUse StandardErrors |
||
91 | */ |
||
92 | /** |
||
93 | * @param Request $request |
||
94 | * @param Response $response |
||
95 | * |
||
96 | * @return mixed |
||
|
|||
97 | * @throws JsonException |
||
98 | */ |
||
99 | public function auth(Request $request, Response $response) |
||
122 | } |
||
123 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.