Skip to content

Commit

Permalink
[FEATURE] Give access-token a new chance
Browse files Browse the repository at this point in the history
Add support to access-token as a header name, instead of
access_token via code. Even if the key name can be changed in the
annotation, this is common enough to deserve some babysitting.
  • Loading branch information
lukewertz authored and Mateu Aguiló Bosch committed Jan 18, 2016
1 parent f295fd6 commit 7349ed0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ protected function extractToken(RequestInterface $request) {

// Access token may be on the request, or in the headers.
$input = $request->getParsedInput();

// If we don't have a $key_name on either the URL or the in the headers,
// then check again using a hyphen instead of an underscore. This is due to
// new versions of Apache not accepting headers with underscores.
if (empty($input[$key_name]) && $request->getHeaders()->get($key_name)->getValueString()) {
$key_name = str_replace('_', '-', $key_name);
}

return empty($input[$key_name]) ? $request->getHeaders()->get($key_name)->getValueString() : $input[$key_name];
}

Expand Down

0 comments on commit 7349ed0

Please sign in to comment.