Skip to content

Commit e724cab

Browse files
Hello AuthorizeController
1 parent d765666 commit e724cab

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Controller;
4+
5+
use Psr\Http\Message\ResponseInterface;
6+
use Psr\Http\Message\ServerRequestInterface;
7+
8+
class AuthorizeController extends AbstractController
9+
{
10+
final public function __invoke(ServerRequestInterface $request, array $args): ResponseInterface
11+
{
12+
$httpHost = $request->getServerParams()['HTTP_HOST'];
13+
$response = $this->getResponse();
14+
15+
$response->getBody()->write("Hello $httpHost");
16+
17+
return $response;
18+
}
19+
}

web/index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Pdsinterop\Solid\Controller\Profile\CardController;
2323
use Pdsinterop\Solid\Controller\Profile\ProfileController;
2424
use Pdsinterop\Solid\Controller\OpenidController;
25+
use Pdsinterop\Solid\Controller\AuthorizeController;
2526
use Psr\Http\Message\ResponseInterface;
2627
use Psr\Http\Message\ServerRequestInterface;
2728

@@ -74,7 +75,8 @@
7475
HelloWorldController::class,
7576
HttpToHttpsController::class,
7677
ProfileController::class,
77-
OpenidController::class
78+
OpenidController::class,
79+
AuthorizeController::class
7880
];
7981

8082
$traits = [
@@ -117,6 +119,7 @@
117119
$router->map('GET', '/profile/card', CardController::class)->setScheme($scheme);
118120
$router->map('GET', '/profile/card{extension}', CardController::class)->setScheme($scheme);
119121
$router->map('GET', '/.well-known/openid-configuration', OpenidController::class)->setScheme($scheme);
122+
$router->map('GET', '/authorize', AuthorizeController::class)->setScheme($scheme);
120123

121124
try {
122125
$response = $router->dispatch($request);

0 commit comments

Comments
 (0)