Skip to content

Commit

Permalink
Strip whitespace before certificate cleanup (#72)
Browse files Browse the repository at this point in the history
* Strip whitespace before certificate cleanup

This insures that the certificate preg_replace cleanup works as
expected

* Add guards to samlidp config file

This fixes the following issue:

ErrorException thrown with message in_array() expects parameter 2
to be array, null given

ErrorException in:
/app/vendor/codegreencreative/laravel-samlidp/src/Listeners/SamlLogout.php:19

* code cleanup

Co-authored-by: Walid Aqleh <[email protected]>
  • Loading branch information
waqleh and wsportradar authored Oct 20, 2021
1 parent 6f4074b commit 1333e97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion config/samlidp.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@
// key is beginning of HTTP_REFERER value from SERVER, value is redirect path
'sp_slo_redirects' => [
// 'https://example.com' => 'https://example.com',
]
],

// List of guards saml idp will catch Authenticated, Login and Logout events
'guards' => ['web']
];
2 changes: 1 addition & 1 deletion src/Http/Controllers/MetadataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function index()
}

$cert = Storage::disk('samlidp')->get(config('samlidp.certname', 'cert.pem'));
$cert = preg_replace('/^\W+\w+\s+\w+\W+\s(.*)\s+\W+.*$/s', '$1', $cert);
$cert = preg_replace('/^\W+\w+\s+\w+\W+\s(.*)\s+\W+.*$/s', '$1', trim($cert));
$cert = str_replace(PHP_EOL, "", $cert);

return response(view('samlidp::metadata', compact('cert')), 200, [
Expand Down

0 comments on commit 1333e97

Please sign in to comment.