1 | <?php |
||
10 | class TokenGuard implements Guard |
||
11 | { |
||
12 | use GuardHelpers; |
||
13 | |||
14 | /** |
||
15 | * The request instance. |
||
16 | * |
||
17 | * @var \Illuminate\Http\Request |
||
18 | */ |
||
19 | protected $request; |
||
20 | |||
21 | /** |
||
22 | * The currently authenticated token. |
||
23 | * |
||
24 | * @var \Illuminate\Database\Eloquent\Model |
||
25 | */ |
||
26 | protected $token; |
||
27 | |||
28 | /** |
||
29 | * The name of the query string item from the request containing the API token. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $inputKey; |
||
34 | |||
35 | /** |
||
36 | * The name of the token "column" in persistent storage. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $storageKey; |
||
41 | |||
42 | /** |
||
43 | * Create a new token guard instance. |
||
44 | * |
||
45 | * @param \Illuminate\Contracts\Auth\UserProvider $provider |
||
46 | * @param \Illuminate\Http\Request $request |
||
47 | * @return void |
||
|
|||
48 | */ |
||
49 | public function __construct(UserProvider $provider, Request $request) |
||
56 | |||
57 | /** |
||
58 | * Get the currently authenticated user. |
||
59 | * |
||
60 | * @return \Illuminate\Contracts\Auth\Authenticatable|null |
||
61 | */ |
||
62 | public function user() |
||
70 | |||
71 | /** |
||
72 | * Get the currently token model. |
||
73 | * |
||
74 | * @return \Illuminate\Database\Eloquent\Model|null |
||
75 | */ |
||
76 | public function token() |
||
86 | |||
87 | /** |
||
88 | * Get the token credentials for the current request. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function getTokenCredentials() |
||
102 | |||
103 | /** |
||
104 | * Retrieve the token for the current request. |
||
105 | * |
||
106 | * @return \Illuminate\Database\Eloquent\Model|null |
||
107 | */ |
||
108 | protected function retrieveTokenForRequest(array $credentials) |
||
116 | |||
117 | /** |
||
118 | * Validate a user's credentials. |
||
119 | * |
||
120 | * @param array $credentials |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function validate(array $credentials = []) |
||
131 | |||
132 | /** |
||
133 | * Set the current request instance. |
||
134 | * |
||
135 | * @param \Illuminate\Http\Request $request |
||
136 | * @return $this |
||
137 | */ |
||
138 | public function setRequest(Request $request) |
||
144 | } |
||
145 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.