From 518c1fcec57a170e09649df38738e06e6e7cbd46 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Tue, 8 Nov 2016 12:27:49 +0000 Subject: [PATCH] Fix middleware example fatal error --- examples/public/middleware_use.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/public/middleware_use.php b/examples/public/middleware_use.php index 2dfe1834..68b4ebc1 100644 --- a/examples/public/middleware_use.php +++ b/examples/public/middleware_use.php @@ -8,6 +8,7 @@ */ use League\OAuth2\Server\AuthorizationServer; +use League\OAuth2\Server\ResourceServer; use League\OAuth2\Server\Grant\AuthCodeGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Middleware\AuthorizationServerMiddleware; @@ -66,6 +67,15 @@ $app = new App([ return $server; }, + ResourceServer::class => function () { + $publicKeyPath = 'file://' . __DIR__ . '/../public.key'; + + $server = new ResourceServer( + new AccessTokenRepository(), + $publicKeyPath + ); + return $server; + }, ]); // Access token issuer @@ -94,6 +104,6 @@ $app->group('/api', function () { return $response->withBody($body); }); -})->add(new ResourceServerMiddleware($app->getContainer()->get(AuthorizationServer::class))); +})->add(new ResourceServerMiddleware($app->getContainer()->get(ResourceServer::class))); $app->run();