1 | <?php |
||
14 | abstract class CheckCredentials |
||
15 | { |
||
16 | /** |
||
17 | * The Resource Server instance. |
||
18 | * |
||
19 | * @var \League\OAuth2\Server\ResourceServer |
||
20 | */ |
||
21 | protected $server; |
||
22 | |||
23 | /** |
||
24 | * Create a new middleware instance. |
||
25 | * |
||
26 | * @param \League\OAuth2\Server\ResourceServer $server |
||
27 | * |
||
28 | * @return void |
||
|
|||
29 | */ |
||
30 | public function __construct(ResourceServer $server) |
||
34 | |||
35 | /** |
||
36 | * Handle an incoming request. |
||
37 | * |
||
38 | * @param \Illuminate\Http\Request $request |
||
39 | * @param \Closure $next |
||
40 | * @param mixed ...$scopes |
||
41 | * |
||
42 | * @throws \Illuminate\Auth\AuthenticationException |
||
43 | * |
||
44 | * @return mixed |
||
45 | */ |
||
46 | public function handle($request, Closure $next, ...$scopes) |
||
65 | |||
66 | /** |
||
67 | * Validate the scopes and token on the incoming request. |
||
68 | * |
||
69 | * @param \Psr\Http\Message\ServerRequestInterface $psr |
||
70 | * @param array $scopes |
||
71 | * |
||
72 | * @throws \Rinvex\Oauth\Exceptions\MissingScopeException|\Illuminate\Auth\AuthenticationException |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | protected function validate($psr, $scopes) |
||
84 | |||
85 | /** |
||
86 | * Validate token credentials. |
||
87 | * |
||
88 | * @param \Rinvex\Oauth\Models\AccessToken $accessToken |
||
89 | * |
||
90 | * @throws \Illuminate\Auth\AuthenticationException |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | abstract protected function validateCredentials($accessToken); |
||
95 | |||
96 | /** |
||
97 | * Validate token scopes. |
||
98 | * |
||
99 | * @param \Rinvex\Oauth\Models\AccessToken $accessToken |
||
100 | * @param array $scopes |
||
101 | * |
||
102 | * @throws \Rinvex\Oauth\Exceptions\MissingScopeException |
||
103 | * |
||
104 | * @return void |
||
105 | */ |
||
106 | abstract protected function validateScopes($accessToken, $scopes); |
||
107 | } |
||
108 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.