From c5853a7552b315fe941fd024593c713d1b5753e0 Mon Sep 17 00:00:00 2001 From: fpeters Date: Thu, 30 Nov 2006 11:45:25 +0000 Subject: [PATCH] new 'info' page; to demo ecp git-svn-id: svn://localhost/lasso-conform/trunk@26 2a3a78c3-912c-0410-af21-e1fb2d1df599 --- lcs/root.ptl | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lcs/root.ptl b/lcs/root.ptl index 59dd8e2..bcdaac1 100644 --- a/lcs/root.ptl +++ b/lcs/root.ptl @@ -64,7 +64,7 @@ class LoginDirectory(Directory): class RootDirectory(Directory): _q_exports = ['', 'admin', 'backoffice', 'login', 'logout', 'liberty', 'saml', - 'ident', 'register'] + 'ident', 'register', 'info'] def _q_index [html] (self): template.html_top('Lasso Conformance SP') @@ -74,6 +74,32 @@ class RootDirectory(Directory): else: self.unlogged_page() + def info(self): + request = get_request() + http_accept = request.environ.get('HTTP_ACCEPT') + http_poas = request.environ.get('HTTP_PAOS') + + if http_accept != 'application/vnd.paos+xml' and http_poas != 'urn:liberty:paos:2003-08': + return template.error_page(_('Invalid PAOS Request')) + + server = misc.get_lasso_server(protocol = 'saml2') + if not server: + return template.error_page(_('SAML 2.0 support not yet configured.')) + login = lasso.Login(server) + # XXX: only works with a single identity provider + login.initAuthnRequest(None, lasso.HTTP_METHOD_SOAP) + login.request.nameIDPolicy.format = lasso.SAML2_NAME_IDENTIFIER_FORMAT_PERSISTENT + login.request.nameIDPolicy.allowCreate = True + login.request.forceAuthn = False + login.request.isPassive = True + login.request.consent = 'urn:oasis:names:tc:SAML:2.0:consent:current-implicit' + #login.request.protocolBinding = lasso.SAML2_METADATA_BINDING_SOAP + login.request.assertionConsumerServiceIndex = 2 + login.buildAuthnRequestMsg() + + response = get_response() + response.set_content_type('text/xml') + return login.msgBody def unlogged_page [html] (self): form = Form(enctype='multipart/form-data', id = 'sso')