Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function check(AuthorizationRequest $authorization): void |
||
22 | { |
||
23 | switch (true) { |
||
24 | case $authorization->hasQueryParam('max_age'): |
||
25 | $max_age = (int) $authorization->getQueryParam('max_age'); |
||
26 | |||
27 | break; |
||
28 | case $authorization->getClient()->has('default_max_age'): |
||
29 | $max_age = (int) $authorization->getClient()->get('default_max_age'); |
||
30 | |||
31 | break; |
||
32 | default: |
||
33 | return; |
||
34 | } |
||
35 | |||
36 | if (null === $authorization->getUserAccount()->getLastLoginAt() || \time() - $authorization->getUserAccount()->getLastLoginAt() > $max_age) { |
||
37 | throw new RedirectToLoginPageException($authorization); |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 |