-Rebasing
This commit is contained in:
parent
d54d78ccc5
commit
b16b4803c5
@ -3,19 +3,15 @@
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
|
||||
use Ulmus\User\{
|
||||
Authorize\HeaderAuthentication,
|
||||
Authorize\HeaderAuthentication, Authorize\PostRequestAuthentication,
|
||||
Entity,
|
||||
Lib\Authenticate,
|
||||
Lib\Authorize,
|
||||
Middleware\AuthenticationMiddleware,
|
||||
Middleware\HeaderAuthenticationMiddleware,
|
||||
Middleware\PostRequestAuthenticationMiddleware,
|
||||
Authorize\PostRequestAuthentication
|
||||
Lib\Authenticate, Lib\Authorize,
|
||||
Middleware\AuthenticationMiddleware, Middleware\HeaderAuthenticationMiddleware, Middleware\PostRequestAuthenticationMiddleware,
|
||||
};
|
||||
|
||||
use Picea\Picea;
|
||||
use Storage\{ Cookie, Session };
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Picea\Picea;
|
||||
|
||||
use function DI\{get, autowire, create};
|
||||
|
||||
@ -39,7 +35,6 @@ return [
|
||||
'authorize.error' => function(ContainerInterface $c) {
|
||||
return function(array $errorData) use ($c) {
|
||||
return $c->get(HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||
|
||||
'api.error' => "Authorization failed",
|
||||
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
||||
], 403);
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
|
||||
use Lean\Factory\{ HttpFactory, HttpFactoryInterface };
|
||||
|
||||
@ -39,7 +39,7 @@ class NotFoundDecorator implements NotFoundDecoratorInterface
|
||||
|
||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
||||
{
|
||||
return $this->checkAssetTrigger($request) ?: $this->httpFactory->createHtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
|
||||
return $this->checkAssetTrigger($request) ?: $this->container->get('error.404');
|
||||
}
|
||||
|
||||
protected function checkAssetTrigger(ServerRequestInterface $request) : false|ResponseInterface
|
||||
|
||||
@ -17,6 +17,5 @@ interface HttpFactoryInterface
|
||||
public static function createDownloadableResponse(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
public static function createImageResponse(string $data, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
public static function createFileDownloadResponse(string $path, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
|
||||
public static function createStream(string $content) : StreamInterface;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user