diff options
Diffstat (limited to 'python/lasso.py')
| -rw-r--r-- | python/lasso.py | 85 |
1 files changed, 69 insertions, 16 deletions
diff --git a/python/lasso.py b/python/lasso.py index b90f8e73..289b94e8 100644 --- a/python/lasso.py +++ b/python/lasso.py @@ -39,12 +39,29 @@ def init(): """ """ return lassomod.init() - def shutdown(): """ """ return lassomod.shutdown() +def assertion_build(response, issuer): + return Node(_obj=lassomod.assertion_build(response, issuer)) +def assertion_add_authenticationStatement(assertion, statement): + return lassomod.assertion_add_authenticationStatement(assertion, statement) + +def authentication_statement_build(authenticationMethod, sessionIndex, + reauthenticateOnOrAfter, + nameIdentifier, nameQualifier, + format, idp_nameIdentifier, + idp_nameQualifier, idp_format, + confirmationMethod): + return Node(_obj=lassomod.authentication_statement_build(authenticationMethod, sessionIndex, + reauthenticateOnOrAfter, + nameIdentifier, nameQualifier, + format, idp_nameIdentifier, + idp_nameQualifier, idp_format, + confirmationMethod)) + class AuthnRequest: def __init__(self, providerID, nameIDPolicy, forceAuthn, isPassive, protocolProfile, assertionConsumerServiceID, authnContextClassRefs, @@ -55,20 +72,20 @@ class AuthnRequest: if _obj != None: self._o = _obj return - self._o = lassomod.authn_request_build(providerID, - nameIDPolicy, - forceAuthn, - isPassive, - protocolProfile, - assertionConsumerServiceID, - authnContextClassRefs, - authnContextStatementRefs, - authnContextComparison, - relayState, - proxyCount, - idpList, - consent) - if self._o is None: raise Error('lasso_authn_request_build() failed') + self._o = lassomod.authn_request_create(providerID, + nameIDPolicy, + forceAuthn, + isPassive, + protocolProfile, + assertionConsumerServiceID, + authnContextClassRefs, + authnContextStatementRefs, + authnContextComparison, + relayState, + proxyCount, + idpList, + consent) + if self._o is None: raise Error('lasso_authn_request_create() failed') def __isprivate(self, name): return name == '_o' def __getattr__(self, name): @@ -79,9 +96,43 @@ class AuthnRequest: ret = lassomod.authn_request_getattr(self, name) if ret is None: raise AttributeError, name - if name == "request": + if name == "node": + ret = Node(_obj=ret) + return ret + +class AuthnResponse: + def __init__(self, query, verify_signature, public_key_file, private_key_file, + certificate_file, is_authenticated, _obj=None): + """ + """ + if _obj != None: + self._o = _obj + return + self._o = lassomod.authn_response_create(query, + verify_signature, + public_key_file, + private_key_file, + certificate_file, + is_authenticated) + if self._o is None: raise Error('lasso_authn_response_create() failed') + def __isprivate(self, name): + return name == '_o' + def __getattr__(self, name): + if self.__isprivate(name): + return self.__dict__[name] + if name[:2] == "__" and name[-2:] == "__" and name != "__members__": + raise AttributeError, name + ret = lassomod.authn_response_getattr(self, name) + if ret is None: + raise AttributeError, name + if name == "node": ret = Node(_obj=ret) return ret + def init(self, providerID, authentication_result): + return lassomod.authn_response_init(self, providerID, + authentication_result) + def add_assertion(self, assertion): + return lassomod.authn_response_add_assertion(self, assertion) class Node: def __init__(self, _obj=None): @@ -96,3 +147,5 @@ class Node: lassomod.node_dump(self, encoding, format) def destroy(self): lassomod.node_unref(self) + def url_encode(self, sign_method, private_key_file): + return lassomod.node_url_encode(self, sign_method, private_key_file) |
