Skip to content

Commit

Permalink
Rename a couple of functions to make get/set pair.
Browse files Browse the repository at this point in the history
  • Loading branch information
terrencegf committed Mar 31, 2020
1 parent 68ed93e commit 0ca022b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/Service/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ public static function handleLogOnButtonClicked()

// Set the cookie for keepidp if the checkbox was checked
$pc = new PortalCookie();
Util::setPortalOrCookie(
Util::setPortalOrCookieVar(
$pc,
'keepidp',
((strlen(Util::getPostVar('keepidp')) > 0) ? 'checked' : '')
Expand All @@ -1892,7 +1892,7 @@ public static function handleLogOnButtonClicked()
(isset($idps[$providerId])));

// Set the cookie for the last chosen IdP and redirect to it if in list
Util::setPortalOrCookie(
Util::setPortalOrCookieVar(
$pc,
'providerId',
($providerIdValid ? $providerId : ''),
Expand Down Expand Up @@ -2045,7 +2045,7 @@ public static function handleNoSubmitButtonClicked()
// make sure that it matches the saved providerId. If not,
// then show the Logon page and uncheck the keepidp checkbox.
if ((strlen($selected_idp) == 0) || ($selected_idp == $providerId)) {
Util::setPortalOrCookie($pc, 'providerId', $providerId, true);
Util::setPortalOrCookieVar($pc, 'providerId', $providerId, true);
$providerName = Util::getAuthzIdP($providerId);
if (in_array($providerName, Util::$oauth2idps)) {
// Log in with an OAuth2 IdP
Expand All @@ -2054,11 +2054,11 @@ public static function handleNoSubmitButtonClicked()
// Log in with InCommon
static::redirectToGetShibUser($providerId);
} else { // $providerId not in whitelist
Util::setPortalOrCookie($pc, 'providerId', '', true);
Util::setPortalOrCookieVar($pc, 'providerId', '', true);
printLogonPage();
}
} else { // selected_idp does not match saved providerId
Util::setPortalOrCookie($pc, 'keepidp', '', true);
Util::setPortalOrCookieVar($pc, 'keepidp', '', true);
printLogonPage();
}
} else { // One of providerId or keepidp was not set
Expand Down Expand Up @@ -2158,7 +2158,7 @@ public static function redirectToGetShibUser(
) {
// If providerId not set, try the cookie value
if (strlen($providerId) == 0) {
$providerId = Util::getPortalOrNormalCookieVar('providerId');
$providerId = Util::getPortalOrCookieVar('providerId');
}

// If the user has a valid 'user_uid' in the PHP session, and the
Expand Down Expand Up @@ -2241,7 +2241,7 @@ public static function redirectToGetOAuth2User(
) {
// If providerId not set, try the cookie value
if (strlen($providerId) == 0) {
$providerId = Util::getPortalOrNormalCookieVar('providerId');
$providerId = Util::getPortalOrCookieVar('providerId');
}

// If the user has a valid 'user_uid' in the PHP session, and the
Expand Down
8 changes: 4 additions & 4 deletions src/Service/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static function unsetCookieVar($cookie)
}

/**
* getPortalOrNormalCookieVar
* getPortalOrlCookieVar
*
* This is a convenience function which first checks if there is a
* OAuth 1.0a ('delegate') or OIDC ('authorize') session active.
Expand All @@ -273,7 +273,7 @@ public static function unsetCookieVar($cookie)
* 'normal' cookie. Return empty string if no matching
* cookie in either place.
*/
public static function getPortalOrNormalCookieVar($cookie)
public static function getPortalOrlCookieVar($cookie)
{
$retval = '';
$pc = new PortalCookie();
Expand Down Expand Up @@ -1041,7 +1041,7 @@ public static function isEduGAINAndGetCert($idp = '', $idp_display_name = '')
}

/**
* setPortalOrCookie
* setPortalOrCookieVar
*
* This is a convenience function for a set of operations that is done
* a few times in Content.php. It first checks if the name of the portal
Expand All @@ -1057,7 +1057,7 @@ public static function isEduGAINAndGetCert($idp = '', $idp_display_name = '')
* @param bool $save (optional) If set to true, attempt to write the
* PortalCookie. Defaults to false.
*/
public static function setPortalOrCookie($pc, $key, $value, $save = false)
public static function setPortalOrCookieVar($pc, $key, $value, $save = false)
{
$pn = $pc->getPortalName();
// If the portal name is valid, then set the PortalCookie key/value
Expand Down

0 comments on commit 0ca022b

Please sign in to comment.