diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-07-16 13:45:35 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-07-16 13:45:35 +0000 |
| commit | 2f3cca14a32b2a7c4d530eb847ed34902734a580 (patch) | |
| tree | b2c57a8f5568aa4aed42c1c4a66939b41d54c765 /python/examples | |
| parent | 3827d324bb20ab60b7a39537fd3b768c9bef4c73 (diff) | |
| download | lasso-2f3cca14a32b2a7c4d530eb847ed34902734a580.tar.gz lasso-2f3cca14a32b2a7c4d530eb847ed34902734a580.tar.xz lasso-2f3cca14a32b2a7c4d530eb847ed34902734a580.zip | |
*** empty log message ***
Diffstat (limited to 'python/examples')
| -rw-r--r-- | python/examples/logout-from-idp.py | 35 | ||||
| -rw-r--r-- | python/examples/user.py | 36 |
2 files changed, 71 insertions, 0 deletions
diff --git a/python/examples/logout-from-idp.py b/python/examples/logout-from-idp.py new file mode 100644 index 00000000..304f397b --- /dev/null +++ b/python/examples/logout-from-idp.py @@ -0,0 +1,35 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +sys.path.insert(0, '../') +import lasso + +lasso.init() + +# server : +server = lasso.Server.new("../../examples/idp.xml", + "../../examples/rsapub.pem", "../../examples/rsakey.pem", "../../examples/rsacert.pem", + lasso.signatureMethodRsaSha1) +server.add_provider("../../examples/sp1.xml", None, None) +server.add_provider("../../examples/sp2.xml", None, None) +server.add_provider("../../examples/sp3.xml", None, None) + +# user : + +sp1_identity = """<LassoIdentity RemoteProviderID="https://service-provider1:2003/liberty-alliance/metadata"><LassoRemoteNameIdentifier><NameIdentifier NameQualifier="https://identity-provider:2003/liberty-alliance/metadata" Format="federated">111111111111111111111111</NameIdentifier></LassoRemoteNameIdentifier></LassoIdentity>""" +sp1_assertion = """<LassoAssertion RemoteProviderID="https://service-provider1:2003/liberty-alliance/metadata"><Assertion AssertionID="1234567890"></Assertion></LassoAssertion>""" + +sp2_identity = """<LassoIdentity RemoteProviderID="https://service-provider2:2003/liberty-alliance/metadata"><LassoRemoteNameIdentifier><NameIdentifier NameQualifier="https://identity-provider:2003/liberty-alliance/metadata" Format="federated">222222222222222222222</NameIdentifier></LassoRemoteNameIdentifier></LassoIdentity>""" +sp2_assertion = """<LassoAssertion RemoteProviderID="https://service-provider2:2003/liberty-alliance/metadata"><Assertion AssertionID="1234567890"></Assertion></LassoAssertion>""" + +user_dump = """<LassoUser><LassoAssertions>%s%s</LassoAssertions><LassoIdentities>%s%s</LassoIdentities></LassoUser>""" % ( + sp1_assertion, sp2_assertion, sp1_identity, sp2_identity) +user = lasso.User.new_from_dump(user_dump); + + +print user.dump() + +# requests : +logout = lasso.Logout.new(server, user, lasso.providerTypeIdp); +next_providerID = user.get_next_providerID(); diff --git a/python/examples/user.py b/python/examples/user.py new file mode 100644 index 00000000..7ebf8b88 --- /dev/null +++ b/python/examples/user.py @@ -0,0 +1,36 @@ +#! /usr/bin/env python + +import sys +sys.path.insert(0, '../') +import lasso + +lasso.init() + + +lasso_assertions = """<LassoAssertions><LassoAssertion RemoteProviderID="https://service-provider1:2003/liberty-alliance/metadata"><Assertion AssertionID="1234567890"></Assertion></LassoAssertion><LassoAssertion RemoteProviderID="https://service-provider2:2003/liberty-alliance/metadata"><Assertion AssertionID="1234567890"></Assertion></LassoAssertion><LassoAssertion RemoteProviderID="https://service-provider3:2003/liberty-alliance/metadata"><Assertion AssertionID="1234567890"></Assertion></LassoAssertion></LassoAssertions>""" + +lasso_identities = """<LassoIdentities><LassoIdentity RemoteProviderID="https://service-provider1:2003/liberty-alliance/metadata"><LassoRemoteNameIdentifier><NameIdentifier>111111111111111111111111111111</NameIdentifier></LassoRemoteNameIdentifier></LassoIdentity></LassoIdentities>""" + + +user_dump = "<LassoUser>%s%s</LassoUser>" % (lasso_assertions, lasso_identities) + +user = lasso.User.new_from_dump(user_dump); + +print "Dump of user environ : %s\n" % user.dump() + +next_provider_id = user.get_next_providerID() +while(next_provider_id): + print "Next provider id : ", next_provider_id + assertion = user.get_assertion(next_provider_id) + print "his Assertion : ", assertion.dump() + print "Remove his assertion from user ..." + user.remove_assertion(next_provider_id) + + next_provider_id = user.get_next_providerID() + +print "All assertions deleted\n" + +print "Dump of user environ :" +print user.dump() + +user.destroy() |
