Conditions | 4 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function check(Authorization $authorization): Authorization |
||
27 | { |
||
28 | try { |
||
29 | if ($authorization->hasQueryParam('claims')) { |
||
30 | $decoded = json_decode($authorization->getQueryParam('claims'), true); |
||
31 | if (!is_array($decoded)) { |
||
32 | throw new \InvalidArgumentException('Invalid "claims" parameter.'); |
||
33 | } |
||
34 | |||
35 | return $authorization->withClaims($decoded); |
||
36 | } |
||
37 | |||
38 | return $authorization; |
||
39 | } catch (\InvalidArgumentException $e) { |
||
40 | throw new OAuth2AuthorizationException(400, OAuth2Message::ERROR_INVALID_REQUEST, $e->getMessage(), $authorization, $e); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |