Skip to content

Commit f49be1a

Browse files
author
Artem Brezhnev
authored
Merge pull request 24Slides#35 from dmyers/patch-2
Improve sls handling of errors to match acs action
2 parents a3c3114 + f397e2a commit f49be1a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Http/Controllers/Saml2Controller.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ public function acs(Auth $auth)
8686
*/
8787
public function sls(Auth $auth)
8888
{
89-
$error = $auth->sls(config('saml2.retrieveParametersFromServer'));
89+
$errors = $auth->sls(config('saml2.retrieveParametersFromServer'));
9090

91-
if (!empty($error)) {
92-
throw new \Exception("Could not log out");
91+
if (!empty($errors)) {
92+
logger()->error('saml2.error_detail', ['error' => $auth->getLastErrorReason()]);
93+
session()->flash('saml2.error_detail', [$auth->getLastErrorReason()]);
94+
95+
logger()->error('saml2.error', $errors);
96+
session()->flash('saml2.error', $errors);
97+
98+
return redirect(config('saml2.errorRoute'));
9399
}
94100

95101
return redirect(config('saml2.logoutRoute')); //may be set a configurable default

0 commit comments

Comments
 (0)