Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad84f23

Browse filesBrowse files
committed
Improved the first example of the Guard authenticator
1 parent f8ddf1f commit ad84f23
Copy full SHA for ad84f23

File tree

Expand file treeCollapse file tree

1 file changed

+3
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-9
lines changed

‎security/guard_authentication.rst

Copy file name to clipboardExpand all lines: security/guard_authentication.rst
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,17 @@ This requires you to implement several methods::
171171
*/
172172
public function supports(Request $request)
173173
{
174-
return true;
174+
return $request->headers->has('X-AUTH-TOKEN')
175175
}
176176

177177
/**
178178
* Called on every request. Return whatever credentials you want to
179-
* be passed to getUser().
179+
* be passed to getUser() as $credentials.
180180
*/
181181
public function getCredentials(Request $request)
182182
{
183-
if (!$token = $request->headers->get('X-AUTH-TOKEN')) {
184-
// No token?
185-
$token = null;
186-
}
187-
188-
// What you return here will be passed to getUser() as $credentials
189183
return array(
190-
'token' => $token,
184+
'token' => $request->headers->get('X-AUTH-TOKEN'),
191185
);
192186
}
193187

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.