Skip to content

Commit

Permalink
Move set/unset of a few session vars from saveUserToDataStore() to se…
Browse files Browse the repository at this point in the history
…tUserAttributeSessionVars().
  • Loading branch information
terrencegf committed Nov 22, 2019
1 parent 29fe4ac commit 8c20a7a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/Service/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ public static function saveUserToDataStore(...$args)
// (e.g., by the error handler in handleGotUser). Then get these
// session variables into local vars for ease of use.
static::setUserAttributeSessionVars(...$args);

$remoteuser = static::getSessionVar('remoteuser');
$idp = static::getSessionVar('idp');
$idpname = static::getSessionVar('idpname');
Expand All @@ -821,8 +822,6 @@ public static function saveUserToDataStore(...$args)
$entitlement = static::getSessionVar('entitlement');
$itrustuin = static::getSessionVar('itrustuin');

static::setSessionVar('submit', static::getSessionVar('responsesubmit'));

// Make sure parameters are not empty strings, and email is valid
// Must have at least one of remoteuser/ePPN/ePTID/openidID/oidcID
if (static::gotUserAttributes()) {
Expand Down Expand Up @@ -964,14 +963,7 @@ public static function saveUserToDataStore(...$args)
);
}
static::unsetSessionVar('authntime');
} else { // status is okay, set authntime
static::setSessionVar('authntime', time());
}

static::unsetSessionVar('responsesubmit');
static::unsetSessionVar('requestsilver');

static::getCsrf()->setCookieAndSession();
}

/**
Expand Down Expand Up @@ -1005,6 +997,13 @@ public static function setUserAttributeSessionVars(...$args)
) {
static::setSessionVar('loa', 'http://incommonfederation.org/assurance/silver');
}

static::setSessionVar('status', '0');
static::setSessionVar('submit', static::getSessionVar('responsesubmit'));
static::setSessionVar('authntime', time());
static::unsetSessionVar('responsesubmit');
static::unsetSessionVar('requestsilver');
static::getCsrf()->setCookieAndSession();
}

/**
Expand Down

0 comments on commit 8c20a7a

Please sign in to comment.