From f20252a5f450476be6e8a9cb9cc36f1a86532e35 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 14 Nov 2018 15:05:44 +0100 Subject: [PATCH] log provisioning errors during sso environment login Signed-off-by: Robin Appelman --- lib/Controller/SAMLController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index 6cbb131..6806c4f 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -146,7 +146,7 @@ class SAMLController extends Controller { if($this->userManager->userExists($uid)) { return; } - throw new NoUserFoundException(); + throw new NoUserFoundException('Auto provisioning not allowed and user ' . $uid . ' does not exist'); } elseif(!$userExists && $autoProvisioningAllowed) { $this->userBackend->createUserIfNotExists($uid); $this->userBackend->updateAttributes($uid, $auth); @@ -154,7 +154,7 @@ class SAMLController extends Controller { } } - throw new NoUserFoundException(); + throw new NoUserFoundException('Remote user environment variable (' . $uidMapping . ') not found in environment'); } /** @@ -186,10 +186,13 @@ class SAMLController extends Controller { $this->autoprovisionIfPossible($this->session->get('user_saml.samlUserData')); $user = $this->userManager->get($this->userBackend->getCurrentUserId()); if(!($user instanceof IUser)) { - throw new NoUserFoundException(); + throw new NoUserFoundException('User' . $this->userBackend->getCurrentUserId() . ' not valid or not found'); } $user->updateLastLoginTimestamp(); } catch (NoUserFoundException $e) { + if ($e->getMessage()) { + $this->logger->warning('Error while trying to login using sso environment variable: ' . $e->getMessage(), ['app' => 'user_saml']); + } $ssoUrl = $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.notProvisioned'); } break;