Compare commits

..

No commits in common. "01d48463b318d2174f8391e30b7f8da62e49717a" and "fda052d2f369cd7bba9110a604601290e09c7b9f" have entirely different histories.

5 changed files with 23 additions and 53 deletions

View File

@ -2,14 +2,12 @@
use Lean\Factory\HttpFactoryInterface;
use Ulmus\User\{Authorize\HeaderAuthentication,
use Ulmus\User\{
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 };
@ -17,7 +15,6 @@ use Psr\Container\ContainerInterface;
use function DI\{get, autowire, create};
return [
Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
@ -38,9 +35,9 @@ 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);
'api.error' => "Authorization failed",
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
], 403);
};
},

View File

@ -1,13 +1,15 @@
<?php
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
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 };
use Picea\Picea;
use function DI\{ autowire, create, get };
use function DI\autowire, DI\create, DI\get;
return [
ServerRequestInterface::class => function ($c) {
@ -18,10 +20,6 @@ return [
EmitterInterface::class => create(SapiEmitter::class),
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
HttpFactoryInterface::class => create(HttpFactory::class),
'error.401' => function(ContainerInterface $c, Picea $picea) {
@ -34,5 +32,9 @@ return [
'error.500' => function(ContainerInterface $c, Picea $picea) {
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/500", []), 500);
}
},
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
];

View File

@ -39,37 +39,4 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy {
{
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
}
/*
<<<<<<< HEAD
public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface
{
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
=======
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (php_sapi_name() !== 'cli' and ! defined('STDIN')) {
return $this->throw404($request);
}
return $handler->handle($request);;
}
public function throw404(ServerRequestInterface $request) : ResponseInterface
{
if ( getenv('DEBUG') && $this->di->has(\Picea\Asset\Asset::class) ) {
$params = $request->getServerParams();
$scpName = basename(explode('?', $params['REQUEST_URI'] ?? "", 2)[0]);
list(, $ext) = array_pad(explode('.', $scpName), 2, null);
if ($ext && in_array($ext, ApplicationStrategy::ASSET_TRIGGER_UPDATE)) {
$this->di->get(\Picea\Asset\Asset::class)->launchInstall();
}
}
return $this->di->get('error.404');
}
};
>>>>>>> af8b686 (- WIP on ulmus-user mechanics updates)
}*/
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -10,7 +10,7 @@
{% if $messageList %}
<div class="message-wrapper">{% php
foreach($messageList as $name => $context) {
foreach($context->formContextMessages ?? [] as $message) {
foreach($context->messages ?? [] as $message) {
echo $message->render();
}
}