Skip to content

Commit

Permalink
Add NameId Format support
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Aug 2, 2017
1 parent 0ba6f67 commit 4825507
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions onelogin-saml-sso/php/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,20 @@ function saml_slo() {
} else {
$nameId = null;
$sessionIndex = null;
$nameIdFormat = null;

if (isset($_COOKIE['saml_nameid'])) {
$nameId = $_COOKIE['saml_nameid'];
}
if (isset($_COOKIE['saml_sessionindex'])) {
$sessionIndex = $_COOKIE['saml_sessionindex'];
}

if (isset($_COOKIE['saml_nameid_format'])) {
$nameIdFormat = $_COOKIE['saml_nameid_format'];
}

$auth = initialize_saml();
$auth->logout(home_url(), array(), $nameId, $sessionIndex);
$auth->logout(home_url(), array(), $nameId, $sessionIndex, false, $nameIdFormat);
return false;
}
}
Expand Down Expand Up @@ -146,6 +151,7 @@ function saml_acs() {

setcookie('saml_nameid', $auth->getNameId(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
setcookie('saml_sessionindex', $auth->getSessionIndex(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
setcookie('saml_nameid_format', $auth->getNameIdFormat(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH );

$attrs = $auth->getAttributes();

Expand Down Expand Up @@ -315,6 +321,7 @@ function saml_sls() {
setcookie('saml_login', 0, time() - 3600, SITECOOKIEPATH );
setcookie('saml_nameid', null, time() - 3600, SITECOOKIEPATH );
setcookie('saml_sessionindex', null, time() - 3600, SITECOOKIEPATH );
setcookie('saml_nameid_format', null, time() - 3600, SITECOOKIEPATH );

if (get_option('onelogin_saml_forcelogin') && get_option('onelogin_saml_customize_stay_in_wordpress_after_slo')) {
wp_redirect(home_url().'/wp-login.php?loggedout=true');
Expand Down

0 comments on commit 4825507

Please sign in to comment.