summaryrefslogtreecommitdiffstats
path: root/python/doc/tutorial/sp-login-send-authn-request.py
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-07-06 18:16:02 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-07-06 18:16:02 +0000
commitac64060db74dca8bd4f6ced4589d479a47242635 (patch)
tree5036db08e3950e374aa871ae80871bb104873253 /python/doc/tutorial/sp-login-send-authn-request.py
parent53dda91b657f818263afd759a24ef3f4966a9f89 (diff)
downloadlasso-ac64060db74dca8bd4f6ced4589d479a47242635.tar.gz
lasso-ac64060db74dca8bd4f6ced4589d479a47242635.tar.xz
lasso-ac64060db74dca8bd4f6ced4589d479a47242635.zip
Added Python files explaining how to create a SP using Lasso.
Diffstat (limited to 'python/doc/tutorial/sp-login-send-authn-request.py')
-rw-r--r--python/doc/tutorial/sp-login-send-authn-request.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/python/doc/tutorial/sp-login-send-authn-request.py b/python/doc/tutorial/sp-login-send-authn-request.py
new file mode 100644
index 00000000..cda934d4
--- /dev/null
+++ b/python/doc/tutorial/sp-login-send-authn-request.py
@@ -0,0 +1,26 @@
+import lasso
+
+
+## Send an authentication request to identity provider.
+##
+## Called when the user press login button on service provider.
+
+server_dump = [...] # Load server_dump from file or database or...
+server = lasso.Server.new_from_dump(server_dump)
+login = lasso.Login.new(server)
+if login.init_authn_request('http://identification.entrouvert.org'):
+ raise Exception('Login error')
+
+# Identity provider will ask user to authenticate himself.
+login.request.set_isPassive(False)
+
+# Identity provider will not ask user to authenticate himself if he has already done it recently.
+# login.request.set_forceAuthn(False)
+
+# Identity provider will create a federation with this service provider and this user, if this was
+# not already done.
+login.request.set_nameIDPolicy(lasso.libNameIDPolicyTypes['federated'])
+
+if login.build_authn_request_msg():
+ raise Exception('Login error')
+[...] # Reply a HTTP redirect to login.msg_url.