diff options
| author | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-07-06 18:16:02 +0000 |
|---|---|---|
| committer | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-07-06 18:16:02 +0000 |
| commit | ac64060db74dca8bd4f6ced4589d479a47242635 (patch) | |
| tree | 5036db08e3950e374aa871ae80871bb104873253 /python/doc/tutorial/sp-login-process-authn-response.py | |
| parent | 53dda91b657f818263afd759a24ef3f4966a9f89 (diff) | |
| download | lasso-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-process-authn-response.py')
| -rw-r--r-- | python/doc/tutorial/sp-login-process-authn-response.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/python/doc/tutorial/sp-login-process-authn-response.py b/python/doc/tutorial/sp-login-process-authn-response.py new file mode 100644 index 00000000..126cd6e0 --- /dev/null +++ b/python/doc/tutorial/sp-login-process-authn-response.py @@ -0,0 +1,32 @@ +import lasso + + +## Process the authentication response returned by identity provider and send received artifact to identity +## provider. +## +## Called after a HTTP redirect from identity provider. + +query = [...] # Get current URL query. +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_request(query, lasso.httpMethods['redirect']: + raise Exception('Login error') +if login.build_request_msg(): + raise Exception('Login error') +soap_response = [...] # Send SOAP message login.msg_body to URL login.msg_url. +if login.handle_response(soap_response): + raise Exception('Login error') +name_identifier = login.response.name_identifier +account = [...] # Retrieve user account having this name_identifier. +if account: + user_dump = [...] # Retrieve string user_dump from account. +else: + account = [...] # Create new account. + user_dump = None +login.set_user_from_dump(user_dump) +# Save the new or updated user_dump into account. +user_dump = login.user.dump() +[...] # Store string user_dump into account. +# User is now authenticated => create session, cookie... +[...] |
