Open diogodomanski opened 5 years ago
Hi @diogodomanski. The library doesn't support PSR-15 at the moment but we will add support for this as our middleware was created prior to this standard. There isn't any guidance on how to achieve this as yet.
We will likely release this in version 8 of the package which is currently some way off being released.
I use the following factory for AuthorizationServerMiddleware
with Zend Expressive 3:
use Psr\Container\ContainerInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use League\OAuth2\Server\Middleware\AuthorizationServerMiddleware;
use League\OAuth2\Server\AuthorizationServer;
class AuthorizationServerMiddlewareFactory
{
public function __invoke(ContainerInterface $container) {
$middleware = new AuthorizationServerMiddleware($container->get(AuthorizationServer::class));
return new class ($middleware) implements MiddlewareInterface {
private $middleware;
public function __construct(callable $middleware)
{
$this->middleware = $middleware;
}
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
return ($this->middleware)(
$request,
new \Zend\Diactoros\Response(),
function ($request, $response) {
return $response;
}
);
}
};
}
}
For ResourceServerMiddleware
is enough to wrap it with Zend\Stratigility\Middleware\DoublePassMiddlewareDecorator
.
Hi,
I'm currently using the PSR-7 version with Zend Expressive 2, but I'm facing some obstacles on adapting it to work with Zend Expressive 3.
Is there any plans to create a PSR-15 version of this project?
Is there any guideline to make it work with Zend Expressive 3?
Thanks