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