Skip to content

Commit

Permalink
fix session end point when null parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
damikael committed Jun 20, 2024
1 parent ead18ff commit d068b28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions config_sample/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"www_dir": "/var/www/html",
"service_name": "",
"log_path": "./log/spid-cie-oidc-php.log",
"homepage": "/test.php",
"default_domain": "default",
"sa": {
"client_id": "http://relying-party-php.org:8003/",
Expand Down
8 changes: 5 additions & 3 deletions lib/OIDC/OP/SessionEndEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function __construct(array $config, Database $database)
*/
public function process()
{
$id_token_hint = $_GET['id_token_hint'];
$post_logout_redirect_uri = $_GET['post_logout_redirect_uri'];
$id_token_hint = isset($_GET['id_token_hint'])? $_GET['id_token_hint'] : null;
$post_logout_redirect_uri = isset($_GET['post_logout_redirect_uri'])? $_GET['post_logout_redirect_uri'] : null;

if ($id_token_hint) {
// @codeCoverageIgnoreStart
Expand Down Expand Up @@ -108,7 +108,9 @@ public function process()
// @codeCoverageIgnoreEnd
}

$logout_url .= 'oidc/rp/' . $request['client_id'] . '/logout?post_logout_redirect_uri=' . $post_logout_redirect_uri;
if(isset($request) && $request!=null) {
$logout_url .= 'oidc/rp/' . $request['client_id'] . '/logout?post_logout_redirect_uri=' . $post_logout_redirect_uri;
}

// @codeCoverageIgnoreStart
header('Location: ' . $logout_url);
Expand Down
10 changes: 8 additions & 2 deletions www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,18 @@ function ($f3) {


//----------------------------------------------------------------------------------------
// DEMO
// HOME
//----------------------------------------------------------------------------------------
$f3->route(
'GET /',
function ($f3) {
$f3->reroute('/test.php');
$config = $f3->get("CONFIG");
$homepage = (isset($config['homepage']) && $config['homepage']!=null)? $config['homepage'] : false;
if($homepage) {
$f3->reroute($config['homepage']);
} else {
$f3->error(400, "Bad Request");
}
}
);

Expand Down

0 comments on commit d068b28

Please sign in to comment.