File tree Expand file tree Collapse file tree 8 files changed +37
-18
lines changed Expand file tree Collapse file tree 8 files changed +37
-18
lines changed Original file line number Diff line number Diff line change 17
17
provides methods and functions to convert SAML classes to and from strings.
18
18
"""
19
19
20
- __version__ = "4.0.3 "
20
+ __version__ = "4.0.4rc1 "
21
21
22
22
import logging
23
23
import six
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
import os
3
+ from base64 import b64encode
4
+ from base64 import b64decode
5
+
3
6
from Cryptodome import Random
4
7
from Cryptodome .Cipher import AES
5
- from base64 import b64encode , b64decode
6
8
7
9
__author__ = 'rolandh'
8
10
Original file line number Diff line number Diff line change 1
1
import base64
2
- # from binascii import hexlify
3
- from binascii import hexlify
4
2
import copy
5
3
import logging
6
- from hashlib import sha1
7
- from Cryptodome .PublicKey import RSA
8
4
import requests
9
5
import six
6
+
7
+ from binascii import hexlify
8
+ from hashlib import sha1
9
+
10
+ # from Crypto.PublicKey import RSA
11
+ from Cryptodome .PublicKey import RSA
12
+
10
13
from saml2 .metadata import ENDPOINTS
11
14
from saml2 .profile import paos , ecp
12
15
from saml2 .soap import parse_soap_enveloped_saml_artifact_resolve
Original file line number Diff line number Diff line change 5
5
import cgi
6
6
import six
7
7
8
- from six .moves .urllib .parse import quote , parse_qs
9
- from six .moves .http_cookies import SimpleCookie
8
+ from future .backports .http .cookies import SimpleCookie
9
+ from future .backports .urllib .parse import quote
10
+ from future .backports .urllib .parse import parse_qs
10
11
11
- from saml2 import BINDING_HTTP_ARTIFACT , SAMLError
12
+ from saml2 import BINDING_HTTP_ARTIFACT
12
13
from saml2 import BINDING_HTTP_REDIRECT
13
14
from saml2 import BINDING_HTTP_POST
14
15
from saml2 import BINDING_URI
15
16
from saml2 import BINDING_SOAP
17
+ from saml2 import SAMLError
16
18
from saml2 import time_util
17
19
18
20
__author__ = 'rohe0002'
@@ -240,10 +242,7 @@ def unpack_redirect(environ):
240
242
241
243
242
244
def unpack_post (environ ):
243
- try :
244
- return dict ([(k , v [0 ]) for k , v in parse_qs (get_post (environ ))])
245
- except Exception :
246
- return None
245
+ return dict ([(k , v [0 ]) for k , v in parse_qs (get_post (environ ))])
247
246
248
247
249
248
def unpack_soap (environ ):
Original file line number Diff line number Diff line change 5
5
WSGI application.
6
6
7
7
"""
8
- import cgi
9
8
import logging
10
9
import sys
11
10
import platform
12
11
import shelve
13
12
import traceback
14
13
import saml2
15
14
import six
16
- from six .moves .urllib .parse import parse_qs , urlparse
17
15
from saml2 .samlp import Extensions
18
16
from saml2 import xmldsig as ds
19
17
18
+ from future .backports .urllib .parse import parse_qs
19
+ from future .backports .urllib .parse import urlparse
20
+
20
21
from six import StringIO
21
22
22
23
from paste .httpexceptions import HTTPSeeOther , HTTPRedirection
Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ def rndstr(size=16, alphabet=""):
169
169
alphabet = string .ascii_letters [0 :52 ] + string .digits
170
170
return type (alphabet )().join (rng .choice (alphabet ) for _ in range (size ))
171
171
172
+
172
173
def rndbytes (size = 16 , alphabet = "" ):
173
174
"""
174
175
Returns rndstr always as a binary type
Original file line number Diff line number Diff line change @@ -101,12 +101,15 @@ def _decode_attribute_value(typ, text):
101
101
102
102
103
103
def _verify_value_type (typ , val ):
104
- #print("verify value type: %s, %s" % (typ, val))
104
+ # print("verify value type: %s, %s" % (typ, val))
105
105
if typ == XSD + "string" :
106
106
try :
107
107
return str (val )
108
108
except UnicodeEncodeError :
109
- return unicode (val )
109
+ if six .PY2 :
110
+ return unicode (val )
111
+ else :
112
+ return val .decode ('utf8' )
110
113
if typ == XSD + "integer" or typ == XSD + "int" :
111
114
return int (val )
112
115
if typ == XSD + "float" or typ == XSD + "double" :
Original file line number Diff line number Diff line change 12
12
import logging
13
13
import os
14
14
import ssl
15
- from six .moves .urllib .parse import urlencode
16
15
17
16
from time import mktime
18
17
from binascii import hexlify
18
+ from future .backports .urllib .parse import urlencode
19
19
import six
20
20
21
+ # from Crypto.PublicKey.RSA import importKey
22
+ # from Crypto.Signature import PKCS1_v1_5
23
+ # from Crypto.Util.asn1 import DerSequence
24
+ # from Crypto.PublicKey import RSA
25
+ # from Crypto.Hash import SHA
26
+ # from Crypto.Hash import SHA224
27
+ # from Crypto.Hash import SHA256
28
+ # from Crypto.Hash import SHA384
29
+ # from Crypto.Hash import SHA512
30
+
21
31
from Cryptodome .PublicKey .RSA import importKey
22
32
from Cryptodome .Signature import PKCS1_v1_5
23
33
from Cryptodome .Util .asn1 import DerSequence
You can’t perform that action at this time.
0 commit comments