saml2: improve authentificatio,

* mandaye/auth/saml2.py: add custom next url for single_sign_on_post
 * mandaye/configs/saml2_example.py: add next_url for single_sign_on_post
 * mandaye/templates/associate.html: improve template
This commit is contained in:
Jérôme Schneider 2013-05-22 09:52:46 +02:00
parent 3cf7195297
commit b8708efc97
6 changed files with 38 additions and 59 deletions

View File

@ -153,7 +153,7 @@ class SAML2Auth(AuthForm):
env['beaker.session']['unique_id'] = login.nameIdentifier.content
env['beaker.session'].save()
return _302('/')
return _302(values['next_url'])
def metadata(self, env, values, request, response):

View File

@ -37,10 +37,6 @@ linuxfr_mapping = [
'method': 'GET',
'response': [{
'filter': auth.sso,
'values': {
'next_url': '/mandaye/login',
'metadata_url': '/mandaye/metadata',
}
}]
},
{
@ -55,6 +51,9 @@ linuxfr_mapping = [
'method': 'POST',
'response': [{
'filter': auth.single_sign_on_post,
'values': {
'next_url': '/mandaye/login',
}
}]
},
]

View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<link rel="stylesheet" href="/static/css/style.css" />
<title>1er connexion</title>
</head>
<body>
<div id="wrap">
<div id="header">
<h1>1er connexion</h1>
<span>Association</span>
</div>
<div id="splash"></div>
<div id="content">
<h1>Première connexion</h1>
<p><a href='logout'>Logout</a></p>
<form action="${action}" method="post" accept-charset="utf-8">
<div>
<label for="username">${username_label}</label>
<input type="text" name="username" value="" id="username" />
</div>
<div>
<label for="password">${password_label}</label>
<input type="password" name="password" value="" id="password" />
</div>
<p><input type="submit" value="Enregistrer"></p>
</form>
</div>
<div id="footer">
Copyright &copy; 2013 Entr'ouvert
</div>
</div>
</body>
</html>

View File

@ -1,30 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="fr-fr" />
<title>1er connexion</title>
</head>
<h3>1er connexion</h3>
% if error_msg:
<p>${error_msg}</p>
% elif description:
<p>${description}</p>
% endif
<form action="${action}" method="post" accept-charset="utf-8">
<div>
<label for="username">${username_label}</label>
<input type="text" name="username" value="" id="username" />
</div>
<div>
<label for="password">${password_label}</label>
<input type="password" name="password" value="" id="password" />
</div>
<p><input type="submit" value="Enregistrer"></p>
</form>
</html>

View File

@ -1,24 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<link rel="stylesheet" href="/static/css/style.css" />
<title>${title}</title>
</head>
<body>
<div id="wrap">
<div id="header">
<h1>Mandaye</h1>
<span>seamless SSO...</span>
</div>
<div id="splash"></div>
<div id="content">
<h1>${title}</h1>
<p>${body}</p>
<p><a href='/'>Back to home</a></p>
</div>
<div id="footer">
Copyright &copy; 2013 Entr'ouvert
</div>
</div>
</body>
</html>