mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-01 08:23:03 +05:30
Fixed ordering so we only hash after base64 encoding
This commit is contained in:
parent
f11e4c81cd
commit
1c36b70dab
@ -144,7 +144,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
|
||||
case 'S256':
|
||||
if (
|
||||
hash_equals(
|
||||
strtr(rtrim(base64_encode(hash('sha256', $codeVerifier)), '='), '+/', '-_'),
|
||||
hash('sha256', strtr(rtrim(base64_encode($codeVerifier), '='), '+/', '-_')),
|
||||
$authCodePayload->code_challenge
|
||||
) === false
|
||||
) {
|
||||
|
@ -767,7 +767,7 @@ class AuthCodeGrantTest extends TestCase
|
||||
'user_id' => 123,
|
||||
'scopes' => ['foo'],
|
||||
'redirect_uri' => 'http://foo/bar',
|
||||
'code_challenge' => strtr(rtrim(base64_encode(hash('sha256', 'foobar')), '='), '+/', '-_'),
|
||||
'code_challenge' => hash('sha256', strtr(rtrim(base64_encode('foobar'), '='), '+/', '-_')),
|
||||
'code_challenge_method' => 'S256',
|
||||
]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user