log provisioning errors during sso environment login

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2018-11-14 15:05:44 +01:00
parent bf4de7be29
commit f20252a5f4

View file

@ -146,7 +146,7 @@ class SAMLController extends Controller {
if($this->userManager->userExists($uid)) { if($this->userManager->userExists($uid)) {
return; return;
} }
throw new NoUserFoundException(); throw new NoUserFoundException('Auto provisioning not allowed and user ' . $uid . ' does not exist');
} elseif(!$userExists && $autoProvisioningAllowed) { } elseif(!$userExists && $autoProvisioningAllowed) {
$this->userBackend->createUserIfNotExists($uid); $this->userBackend->createUserIfNotExists($uid);
$this->userBackend->updateAttributes($uid, $auth); $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')); $this->autoprovisionIfPossible($this->session->get('user_saml.samlUserData'));
$user = $this->userManager->get($this->userBackend->getCurrentUserId()); $user = $this->userManager->get($this->userBackend->getCurrentUserId());
if(!($user instanceof IUser)) { if(!($user instanceof IUser)) {
throw new NoUserFoundException(); throw new NoUserFoundException('User' . $this->userBackend->getCurrentUserId() . ' not valid or not found');
} }
$user->updateLastLoginTimestamp(); $user->updateLastLoginTimestamp();
} catch (NoUserFoundException $e) { } 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'); $ssoUrl = $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.notProvisioned');
} }
break; break;