Skip to content

Commit 2261c1c

Browse files
authored
Merge pull request #129 from stampycode/patch-1
bugfix: 'kid' not in given key list
2 parents d6b3174 + 64d7eb0 commit 2261c1c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/JWT.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public static function decode($jwt, $key, $allowed_algs = array())
100100
}
101101
if (is_array($key) || $key instanceof \ArrayAccess) {
102102
if (isset($header->kid)) {
103+
if (!isset($key[$header->kid])) {
104+
throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
105+
}
103106
$key = $key[$header->kid];
104107
} else {
105108
throw new UnexpectedValueException('"kid" empty, unable to lookup correct key');

0 commit comments

Comments
 (0)