diff options
Diffstat (limited to 'python/doc/tutorial/sp-login-send-authn-request.py')
| -rw-r--r-- | python/doc/tutorial/sp-login-send-authn-request.py | 26 |
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. |
