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

RelayState is missing #151

Open
Spartaseventy opened this issue Sep 10, 2024 · 0 comments
Open

RelayState is missing #151

Spartaseventy opened this issue Sep 10, 2024 · 0 comments

Comments

@Spartaseventy
Copy link

Quando si usa il login in HTTP-POST il campo RelayState all'interno del form che viene inviato risulta vuoto.
Analizzando il codice ho notato questo:

public function postForm($url, $redirectTo = null)
    {
        $SAMLRequest = base64_encode($this->xml);

        $relayState = is_null($redirectTo) ? (isset($_SERVER['HTTPS']) &&
            $_SERVER['HTTPS'] === 'on' ? "https" : "http") .
            "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" : $redirectTo;
        $relayState = base64_encode($relayState);

        return <<<HTML
<html>
    <body onload="javascript:document.forms[0].submit()">
        <form method="post" action="$url">
            <input type="hidden" name="SAMLRequest" value="$SAMLRequest">
            <input type="hidden" name="RelayState" value="$relayState">
        </form>
    </body>
</html>
HTML;
    }

Effettuando un check con spid_sp_test infatti si ottiene questo:
ERROR:spid_sp_test.authn_request:RelayState is missing

La variable $relayState è risettata a NULL quando invece dovrebbe essere qualcosa del tipo
$relayState = base64_encode($relayState)

Dopo la modifica il test su descritto viene correttamente passato

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

No branches or pull requests

1 participant