Skip to content

Commit a0dfea9

Browse files
committed
URL-decode client credentials in HTTP Basic auth, as described in RFC 6749
1 parent 5a0c800 commit a0dfea9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/OAuth2/ClientAssertionType/HttpBasic.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ public function getClientId()
115115
public function getClientCredentials(RequestInterface $request, ResponseInterface $response = null)
116116
{
117117
if (!is_null($request->headers('PHP_AUTH_USER')) && !is_null($request->headers('PHP_AUTH_PW'))) {
118-
return array('client_id' => $request->headers('PHP_AUTH_USER'), 'client_secret' => $request->headers('PHP_AUTH_PW'));
118+
return array(
119+
/**
120+
* client credentials are URL-encoded before being encoded in the HTTP Basic header, so we decode them here
121+
* @see http://tools.ietf.org/html/rfc6749#section-2.3.1
122+
*/
123+
'client_id' => urldecode($request->headers('PHP_AUTH_USER')),
124+
'client_secret' => urldecode($request->headers('PHP_AUTH_PW')),
125+
);
119126
}
120127

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

0 commit comments

Comments
 (0)