Skip to content
Snippets Groups Projects
Commit 8d181c0a authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Further twigify negotiate

parent 01d42fee
Branches
Tags
No related merge requests found
......@@ -238,22 +238,19 @@ class Negotiate extends \SimpleSAML\Auth\Source
*/
protected function sendNegotiate($params)
{
$config = \SimpleSAML\Configuration::getInstance();
$url = htmlspecialchars(\SimpleSAML\Module::getModuleURL('negotiate/backend.php', $params));
$json_url = json_encode($url);
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Negotiate', false);
echo <<<EOF
<html>
<head>
<script type="text/javascript">window.location = $json_url</script>
<title>Redirect to login</title>
</head>
<body>
<p>Your browser seems to have Javascript disabled. Please click <a href="$url">here</a>.</p>
</body>
</html>
EOF;
$t = new \SimpleSAML\XHTML\Template($config, 'negotiate:redirect.twig');
$t->data['baseurlpath'] = \SimpleSAML\Module::getModuleUrl('negotiate');
$t->data['url'] = $url;
$t->data['json_url'] = $json_url;
$t->show();
}
......
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<script src="{{ baseurlpath }}/assets/js/redirect.js"></script>
<title>Redirect to login</title>
</head>
<body>
<p>Your browser seems to have Javascript disabled. Please click <a id="redirect" href="{{ url }}">here</a>.</p>
</body>
</html>
document.addEventListener('DOMContentLoaded', function () {
window.location = document.querySelector('#redirect');
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment