mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-05-02 09:14:50 +02:00
Perform logic in ACS
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
bc98b466bd
commit
5a4d327c0a
|
@ -31,6 +31,7 @@ use OCP\ILogger;
|
|||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
|
||||
|
@ -212,6 +213,15 @@ class SAMLController extends Controller {
|
|||
return new Http\RedirectResponse($this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.notProvisioned'));
|
||||
}
|
||||
|
||||
try {
|
||||
$user = $this->userManager->get($this->userBackend->getCurrentUserId());
|
||||
if(!($user instanceof IUser)) {
|
||||
throw new \InvalidArgumentException('User is not valid');
|
||||
}
|
||||
$user->updateLastLoginTimestamp();
|
||||
} catch (\Exception $e) {
|
||||
return new Http\RedirectResponse($this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.notProvisioned'));
|
||||
}
|
||||
$this->session->set('user_saml.samlUserData', $auth->getAttributes());
|
||||
$this->session->set('user_saml.samlNameId', $auth->getNameId());
|
||||
$this->session->set('user_saml.samlSessionIndex', $auth->getSessionIndex());
|
||||
|
|
|
@ -447,7 +447,6 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
}
|
||||
|
||||
if ($user !== null) {
|
||||
$user->updateLastLoginTimestamp();
|
||||
$currentEmail = (string)$user->getEMailAddress();
|
||||
if ($newEmail !== null
|
||||
&& $currentEmail !== $newEmail) {
|
||||
|
|
|
@ -93,9 +93,6 @@ class UserBackendTest extends TestCase {
|
|||
->method('get')
|
||||
->with('ExistingUser')
|
||||
->willReturn($user);
|
||||
$user
|
||||
->expects($this->once())
|
||||
->method('updateLastLoginTimestamp');
|
||||
$user
|
||||
->expects($this->once())
|
||||
->method('getEMailAddress')
|
||||
|
@ -143,9 +140,6 @@ class UserBackendTest extends TestCase {
|
|||
->method('get')
|
||||
->with('ExistingUser')
|
||||
->willReturn($user);
|
||||
$user
|
||||
->expects($this->once())
|
||||
->method('updateLastLoginTimestamp');
|
||||
$user
|
||||
->expects($this->once())
|
||||
->method('getEMailAddress')
|
||||
|
|
Loading…
Reference in a new issue