Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | public function grant(TokenRequestAttempt $tokenRequestAttempt) |
||
23 | { |
||
24 | GrantTypeUtils::ensureRequestedGrantTypeIsSupported($this, $tokenRequestAttempt); |
||
25 | |||
26 | try { |
||
27 | GrantTypeUtils::ensureInputDataAreValid($this, $tokenRequestAttempt); |
||
28 | |||
29 | } catch (MissingOrInvalidInputData $e) { |
||
30 | |||
31 | return GrantDecision::denied(GrantError::invalidRequest($e->getMessage())); |
||
32 | } |
||
33 | |||
34 | if (true === $this->clientAuthenticator->isClientValid( |
||
35 | $tokenRequestAttempt->getInputData()->getClientId(), |
||
36 | $tokenRequestAttempt->getInputData()->getClientSecret() |
||
37 | ) |
||
38 | ) { |
||
39 | |||
40 | return GrantDecision::allowed(); |
||
41 | } |
||
42 | |||
43 | return GrantDecision::denied(GrantError::accessDenied()); |
||
44 | } |
||
45 | |||
59 |