Skip to content

URL-decode client credentials in HTTP Basic auth, as described in the RFC #979

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
9 changes: 8 additions & 1 deletion src/OAuth2/ClientAssertionType/HttpBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ public function getClientId()
public function getClientCredentials(RequestInterface $request, ResponseInterface $response = null)
{
if (!is_null($request->headers('PHP_AUTH_USER')) && !is_null($request->headers('PHP_AUTH_PW'))) {
return array('client_id' => $request->headers('PHP_AUTH_USER'), 'client_secret' => $request->headers('PHP_AUTH_PW'));
return array(
/**
* client credentials are URL-encoded before being encoded in the HTTP Basic header, so we decode them here
* @see http://tools.ietf.org/html/rfc6749#section-2.3.1
*/
'client_id' => urldecode($request->headers('PHP_AUTH_USER')),
'client_secret' => urldecode($request->headers('PHP_AUTH_PW')),
);
}

if ($this->config['allow_credentials_in_request_body']) {
Expand Down