8000 Fix Authenticator Class (getCredentials) example by thtroyer · Pull Request #7065 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content
8000

Fix Authenticator Class (getCredentials) example #7065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Authenticator class example - adjusting solution from feedback.
  • Loading branch information
thtroyer committed Nov 28, 2016
commit ebb81536cb140a476bb37f005d08a3eda579fe88
7 changes: 2 additions & 5 deletions security/guard_authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,14 @@ This requires you to implement six methods::
{
/**
* Called on every request. Return whatever credentials you want to
* be passed to getUser(). Returning null will cause this authenticator
* be passed to getUser(). Returning null will cause this authenticator
* to be skipped.
*/
public function getCredentials(Request $request)
{
if (!$token = $request->headers->get('X-AUTH-TOKEN')) {
// No token?
// Throwing an exception will cause authentication
// to fail and prevent other authenticators from
// attempting to authenticate.
throw new AuthenticationException('No token provided.');
$token = null;
}

// What you return here will be passed to getUser() as $credentials
Expand Down
0