Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLO not redirecting to specified URL ($auth->logout($returnTo);) #519

Open
it-esfl opened this issue Mar 8, 2022 · 3 comments
Open

SLO not redirecting to specified URL ($auth->logout($returnTo);) #519

it-esfl opened this issue Mar 8, 2022 · 3 comments

Comments

@it-esfl
Copy link

it-esfl commented Mar 8, 2022

Hi there,

is it normal behavior that an SLO with $auth->logout($returnTo); does not redirect to the named URL?
In my case after a successful SLO (sessions are cleared correctly) it just says "Sucessfully logged out" (the URL in the browser in my case is index.php?sls&SAMLResponse=XXX&RelayState=correct_URL&....). So it seems that the URL from RelayState is not applied. Is this a known behavior or possibly a misconfiguration?

Many thanks in advance!

@MitchTalmadge
Copy link

We are running into the same issue. Did you find anything?

@farahalrabee2
Copy link

i'm facing the same issue , any update ? @it-esfl

@pitbulk
Copy link
Contributor

pitbulk commented Dec 29, 2022

@it-esfl, @MitchTalmadge, @farahalrabee2

If you are using the code of the demo1

else if (isset($_GET['sls'])) {
    if (isset($_SESSION) && isset($_SESSION['LogoutRequestID'])) {
        $requestID = $_SESSION['LogoutRequestID'];
    } else {
        $requestID = null;
    }

    $auth->processSLO(false, $requestID);
    $errors = $auth->getErrors();
    if (empty($errors)) {
        echo '<p>Sucessfully logged out</p>';
    } else {
        echo '<p>' . htmlentities(implode(', ', $errors)) . '</p>';
        if ($auth->getSettings()->isDebugActive()) {
            echo '<p>'.htmlentities($auth->getLastErrorReason()).'</p>';
        }
    }

Such code in case of success on a SP-initiaited Single Logout process, ends printing the "Sucessfully logged out" that you comment. But this is just a demo.

You could improve the code and take care of the redirection, ideally due UX, first notify the user about the logout action
and then redirecting so for example:

 echo '<p>Sucessfully logged out</p>';
 if (isset($_GET['RelayState'])) {
     // Add code to confirm RelayState is a trusted URL before redirecting
     
    echo '
        <script>
        setTimeout(function () {
            window.location.href="'.$_GET["RelayState"].'";
        },5000);
       </script> 
    '; 
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants