-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Endpoint to handle callback from OneLogin (#2399)
* Add pull target to Makefile to ease updates * Add dummy endpoint and routes update. * Put route behind feature flag and add parameter checking to the endpoint
- Loading branch information
Showing
3 changed files
with
98 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
service-front/app/src/Actor/src/Handler/OneLoginCallbackHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Actor\Handler; | ||
|
||
use Common\Handler\AbstractHandler; | ||
use Laminas\Diactoros\Response\HtmlResponse; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
use RuntimeException; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class OneLoginCallbackHandler extends AbstractHandler | ||
{ | ||
public function handle(ServerRequestInterface $request): ResponseInterface | ||
{ | ||
$authParams = $request->getQueryParams(); | ||
|
||
if (!array_key_exists('code', $authParams) || !array_key_exists('state', $authParams)) { | ||
throw new RuntimeException('Required parameters not passed for authentication', 500); | ||
} | ||
|
||
return new HtmlResponse('<h1>Hello World</h1>'); | ||
} | ||
} |