/home/techb158/dev.balacoffee.com/vendor/laravel/passport/src/Http/Middleware
Edit: /home/techb158/dev.balacoffee.com/vendor/laravel/passport/src/Http/Middleware/CheckCredentials.php (2888B)
server = $server;
$this->repository = $repository;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param mixed ...$scopes
* @return mixed
*
* @throws \Illuminate\Auth\AuthenticationException
*/
public function handle($request, Closure $next, ...$scopes)
{
$psr = (new PsrHttpFactory(
new Psr17Factory,
new Psr17Factory,
new Psr17Factory,
new Psr17Factory
))->createRequest($request);
try {
$psr = $this->server->validateAuthenticatedRequest($psr);
} catch (OAuthServerException $e) {
throw new AuthenticationException;
}
$this->validate($psr, $scopes);
return $next($request);
}
/**
* Validate the scopes and token on the incoming request.
*
* @param \Psr\Http\Message\ServerRequestInterface $psr
* @param array $scopes
* @return void
*
* @throws \Laravel\Passport\Exceptions\MissingScopeException|\Illuminate\Auth\AuthenticationException
*/
protected function validate($psr, $scopes)
{
$token = $this->repository->find($psr->getAttribute('oauth_access_token_id'));
$this->validateCredentials($token);
$this->validateScopes($token, $scopes);
}
/**
* Validate token credentials.
*
* @param \Laravel\Passport\Token $token
* @return void
*
* @throws \Illuminate\Auth\AuthenticationException
*/
abstract protected function validateCredentials($token);
/**
* Validate token scopes.
*
* @param \Laravel\Passport\Token $token
* @param array $scopes
* @return void
*
* @throws \Laravel\Passport\Exceptions\MissingScopeException
*/
abstract protected function validateScopes($token, $scopes);
}