1 | <?php |
||
27 | class AuthorizationServer implements EmitterAwareInterface |
||
28 | { |
||
29 | use EmitterAwareTrait; |
||
30 | |||
31 | /** |
||
32 | * @var GrantTypeInterface[] |
||
33 | */ |
||
34 | protected $enabledGrantTypes = []; |
||
35 | |||
36 | /** |
||
37 | * @var \DateInterval[] |
||
38 | */ |
||
39 | protected $grantTypeAccessTokenTTL = []; |
||
40 | |||
41 | /** |
||
42 | * @var CryptKey |
||
43 | */ |
||
44 | protected $privateKey; |
||
45 | |||
46 | /** |
||
47 | * @var CryptKey |
||
48 | */ |
||
49 | protected $publicKey; |
||
50 | |||
51 | /** |
||
52 | * @var null|ResponseTypeInterface |
||
53 | */ |
||
54 | protected $responseType; |
||
55 | |||
56 | /** |
||
57 | * @var ClientRepositoryInterface |
||
58 | */ |
||
59 | private $clientRepository; |
||
60 | |||
61 | /** |
||
62 | * @var AccessTokenRepositoryInterface |
||
63 | */ |
||
64 | private $accessTokenRepository; |
||
65 | |||
66 | /** |
||
67 | * @var ScopeRepositoryInterface |
||
68 | */ |
||
69 | private $scopeRepository; |
||
70 | |||
71 | /** |
||
72 | * @var string|Key |
||
73 | */ |
||
74 | private $encryptionKey; |
||
75 | |||
76 | /** |
||
77 | * @var string |
||
78 | */ |
||
79 | private $defaultScope = ''; |
||
80 | |||
81 | /** |
||
82 | * New server instance. |
||
83 | * |
||
84 | * @param ClientRepositoryInterface $clientRepository |
||
85 | * @param AccessTokenRepositoryInterface $accessTokenRepository |
||
86 | * @param ScopeRepositoryInterface $scopeRepository |
||
87 | * @param CryptKey|string $privateKey |
||
88 | * @param string|Key $encryptionKey |
||
89 | * @param null|ResponseTypeInterface $responseType |
||
90 | */ |
||
91 | 9 | public function __construct( |
|
110 | |||
111 | /** |
||
112 | * Enable a grant type on the server. |
||
113 | * |
||
114 | * @param GrantTypeInterface $grantType |
||
115 | * @param null|\DateInterval $accessTokenTTL |
||
116 | */ |
||
117 | 7 | public function enableGrantType(GrantTypeInterface $grantType, \DateInterval $accessTokenTTL = null) |
|
134 | |||
135 | /** |
||
136 | * Validate an authorization request |
||
137 | * |
||
138 | * @param ServerRequestInterface $request |
||
139 | * |
||
140 | * @throws OAuthServerException |
||
141 | * |
||
142 | * @return AuthorizationRequest |
||
143 | */ |
||
144 | 3 | public function validateAuthorizationRequest(ServerRequestInterface $request) |
|
154 | |||
155 | /** |
||
156 | * Complete an authorization request |
||
157 | * |
||
158 | * @param AuthorizationRequest $authRequest |
||
159 | * @param ResponseInterface $response |
||
160 | * |
||
161 | * @return ResponseInterface |
||
162 | */ |
||
163 | 1 | public function completeAuthorizationRequest(AuthorizationRequest $authRequest, ResponseInterface $response) |
|
169 | |||
170 | /** |
||
171 | * Return an access token response. |
||
172 | * |
||
173 | * @param ServerRequestInterface $request |
||
174 | * @param ResponseInterface $response |
||
175 | * |
||
176 | * @throws OAuthServerException |
||
177 | * |
||
178 | * @return ResponseInterface |
||
179 | */ |
||
180 | 4 | public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseInterface $response) |
|
199 | |||
200 | /** |
||
201 | * Return an introspection response. |
||
202 | * |
||
203 | * @param ServerRequestInterface $request |
||
204 | * @param ResponseInterface $response |
||
205 | * |
||
206 | * @return ResponseInterface |
||
207 | */ |
||
208 | public function respondToIntrospectionRequest(ServerRequestInterface $request, ResponseInterface $response) |
||
215 | |||
216 | /** |
||
217 | * Get the token type that grants will return in the HTTP response. |
||
218 | * |
||
219 | * @return ResponseTypeInterface |
||
220 | */ |
||
221 | 4 | protected function getResponseType() |
|
234 | |||
235 | /** |
||
236 | * Set the default scope for the authorization server. |
||
237 | * |
||
238 | * @param string $defaultScope |
||
239 | */ |
||
240 | 3 | public function setDefaultScope($defaultScope) |
|
244 | } |
||
245 |
This check looks for function calls that miss required arguments.