summaryrefslogtreecommitdiffstats
path: root/python/examples/login.py
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-07-10 23:01:05 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-07-10 23:01:05 +0000
commit3677573bee663ff680489855724dcdc8360e6860 (patch)
tree875e729f0259937ce87dfe930b4fdd02b379887b /python/examples/login.py
parent1ed5aafdc04e029d9a902fd8b6df2220820c519f (diff)
downloadlasso-3677573bee663ff680489855724dcdc8360e6860.tar.gz
lasso-3677573bee663ff680489855724dcdc8360e6860.tar.xz
lasso-3677573bee663ff680489855724dcdc8360e6860.zip
*** empty log message ***
Diffstat (limited to 'python/examples/login.py')
-rw-r--r--python/examples/login.py36
1 files changed, 34 insertions, 2 deletions
diff --git a/python/examples/login.py b/python/examples/login.py
index d9e11230..04d21b57 100644
--- a/python/examples/login.py
+++ b/python/examples/login.py
@@ -3,6 +3,8 @@
import sys
sys.path.insert(0, '../')
+import string
+
import lasso
lasso.init()
@@ -16,7 +18,7 @@ server = lasso.Server.new("../../examples/sp.xml",
server.add_provider("../../examples/idp.xml", None, None)
-# creation d'une AuthnRequest
+# create AuthnRequest
splogin = lasso.Login.new(server, None)
ret = splogin.init_authn_request("https://identity-provider:2003/liberty-alliance/metadata")
splogin.request.set_isPassive(0)
@@ -28,5 +30,35 @@ splogin.request.set_protocolProfile(lasso.libProtocolProfileBrwsArt)
print "Request type =", splogin.request_type
print splogin.request.dump()
-print splogin.build_authn_request_msg()
+splogin.build_authn_request_msg()
print "message url =", splogin.msg_url
+
+#####################
+# Identity provider #
+#####################
+server = lasso.Server.new("../../examples/idp.xml",
+ None, "../../examples/rsakey.pem", "../../examples/rootcert.pem",
+ lasso.SignatureMethodRsaSha1)
+
+server.add_provider("../../examples/sp.xml",
+ "../../examples/rsapub.pem", "../../examples/rsacert.pem")
+
+# create AuthnResponse OR artifact (depending ProtocolProfile)
+idplogin = lasso.Login.new(server, None)
+
+# get query part in msg_url
+authn_request_msg = string.split(splogin.msg_url, '?')[1]
+ret = idplogin.init_from_authn_request_msg(authn_request_msg,
+ lasso.HttpMethodRedirect);
+
+print "ProtocolProfile =", idplogin.protocolProfile
+
+must_authenticate = idplogin.must_authenticate()
+print "User must be authenticated =", idplogin.protocolProfile
+
+if idplogin.protocolProfile == 1:
+ ret = idplogin.build_artifact_msg(1,
+ lasso.samlAuthenticationMethodPassword,
+ "",
+ lasso.HttpMethodRedirect)
+ print "ret = %d, msg_url = %s" % (ret, idplogin.msg_url)