Skip to content

RelayState is missing #151

@Spartaseventy

Description

@Spartaseventy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions