1 | <?php namespace Nord\Lumen\OAuth2; |
||
8 | class OAuth2Service implements OAuth2ServiceContract |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @var AuthorizationServer |
||
13 | */ |
||
14 | private $authorizationServer; |
||
15 | |||
16 | /** |
||
17 | * @var ResourceServer |
||
18 | */ |
||
19 | private $resourceServer; |
||
20 | |||
21 | |||
22 | /** |
||
23 | * OAuth2Server constructor. |
||
24 | * |
||
25 | * @param AuthorizationServer $authorizationServer |
||
26 | * @param ResourceServer $resourceServer |
||
27 | */ |
||
28 | public function __construct(AuthorizationServer $authorizationServer, ResourceServer $resourceServer) |
||
33 | |||
34 | |||
35 | /** |
||
36 | * @return array |
||
37 | * @throws \League\OAuth2\Server\Exception\InvalidRequestException |
||
38 | * @throws \League\OAuth2\Server\Exception\UnsupportedGrantTypeException |
||
39 | */ |
||
40 | public function issueAccessToken() |
||
44 | |||
45 | |||
46 | /** |
||
47 | * @param bool $headersOnly |
||
48 | * @param null|string $accessToken |
||
49 | * |
||
50 | * @return bool |
||
51 | * @throws \League\OAuth2\Server\Exception\AccessDeniedException |
||
52 | */ |
||
53 | public function validateAccessToken($headersOnly = true, $accessToken = null) |
||
57 | |||
58 | |||
59 | /** |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getResourceOwnerId() |
||
69 | |||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getResourceOwnerType() |
||
81 | |||
82 | |||
83 | /** |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getClientId() |
||
93 | |||
94 | /** |
||
95 | * Check authorize parameters |
||
96 | * |
||
97 | * @return array Authorize request parameters |
||
98 | * @throws \League\OAuth2\Server\Exception\InvalidRequestException |
||
99 | * @throws \League\OAuth2\Server\Exception\InvalidClientException |
||
100 | * @throws \League\OAuth2\Server\Exception\UnsupportedResponseTypeException |
||
101 | */ |
||
102 | public function checkAuthorizeParams() |
||
112 | |||
113 | /** |
||
114 | * Parse a new authorize request |
||
115 | * |
||
116 | * @param string $type The session owner's type |
||
117 | * @param string $typeId The session owner's ID |
||
118 | * @param array $authParams The authorize request $_GET parameters |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function newAuthorizeRequest($type, $typeId, $authParams = []) |
||
132 | } |
||
133 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.