diff options
author | Roland Hedberg <roland.hedberg@adm.umu.se> | 2013-12-13 13:44:53 +0100 |
---|---|---|
committer | Roland Hedberg <roland.hedberg@adm.umu.se> | 2013-12-13 13:44:53 +0100 |
commit | b6336dc0cda2626c010894a0ff978b6c67516d60 (patch) | |
tree | 289bb714419ded36b1dfb1c9fb8187f9f0610784 /src/saml2/pack.py | |
parent | c2701e9ba2c768d62dd54e171b51229a21135e83 (diff) | |
download | pysaml2-b6336dc0cda2626c010894a0ff978b6c67516d60.tar.gz |
Fixed all tests and various bugs that appeared during that process.
Diffstat (limited to 'src/saml2/pack.py')
-rw-r--r-- | src/saml2/pack.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/saml2/pack.py b/src/saml2/pack.py index 8f28d341..a63d1bba 100644 --- a/src/saml2/pack.py +++ b/src/saml2/pack.py @@ -30,11 +30,9 @@ import urllib from saml2.s_utils import deflate_and_base64_encode from saml2.s_utils import Unsupported import logging -from saml2.sigver import RSA_SHA1 from saml2.sigver import REQ_ORDER from saml2.sigver import RESP_ORDER -from saml2.sigver import RSASigner -from saml2.sigver import sha1_digest +from saml2.sigver import SIGNER_ALGS logger = logging.getLogger(__name__) @@ -133,13 +131,14 @@ def http_redirect_message(message, location, relay_state="", typ="SAMLRequest", args["SigAlg"] = sigalg - if sigalg == RSA_SHA1: - signer = RSASigner(sha1_digest, "sha1") + try: + signer = SIGNER_ALGS[sigalg] + except: + raise Unsupported("Signing algorithm") + else: string = "&".join([urllib.urlencode({k: args[k]}) for k in _order if k in args]) args["Signature"] = base64.b64encode(signer.sign(string, key)) string = urllib.urlencode(args) - else: - raise Unsupported("Signing algorithm") else: string = urllib.urlencode(args) |