Permalink
Browse files

feature #4128 Finished #3759 (WouterJ)

This PR was merged into the 2.4 branch.

Discussion
----------

Finished #3759

Finished the great start by @BourotBenjamin in #3759

Commits
-------

529675a Check for api_key in request
59e4bd4 Update api_key_authentication.rst - POST Method
  • Loading branch information...
weaverryan committed Aug 16, 2014
2 parents 4629d8b + 529675a commit 08bed5fd0d9239ef5d59ec06e1c6571198daf275
Showing with 8 additions and 2 deletions.
  1. +8 −2 cookbook/security/api_key_authentication.rst
@@ -45,13 +45,19 @@ value and then a User object is created::
public function createToken(Request $request, $providerKey)
{
if (!$request->query->has('apikey')) {
// look for an apikey query parameter
$apiKey = $request->query->get('apikey');
// or if you want to use an "apikey" header, then do something like this:
// $apiKey = $request->headers->get('apikey');
if (!$apiKey) {
throw new BadCredentialsException('No API key found');
}
return new PreAuthenticatedToken(
'anon.',
$request->query->get('apikey'),
$apiKey,
$providerKey
);
}

0 comments on commit 08bed5f

Please sign in to comment.