Skip to content

Commit 8c901a8

Browse files
author
Hans Hörberg
committed
Added configuration so the test idp can change sign and digest algorithm.
If SIGN_ALG = None DIGEST_ALG = None in service_conf sha1 will be used.
1 parent 1d1b7b2 commit 8c901a8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

example/idp2/idp.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from idp_user import USERS
5252
from idp_user import EXTRA
5353
from mako.lookup import TemplateLookup
54+
import saml2.xmldsig as ds
5455

5556
logger = logging.getLogger("saml2.idp")
5657
logger.setLevel(logging.WARNING)
@@ -1067,6 +1068,18 @@ def application(environ, start_response):
10671068
HOST = CONFIG.HOST
10681069
PORT = CONFIG.PORT
10691070

1071+
sign_alg = None
1072+
digest_alg = None
1073+
try:
1074+
sign_alg = CONFIG.SIGN_ALG
1075+
except:
1076+
pass
1077+
try:
1078+
digest_alg = CONFIG.DIGEST_ALG
1079+
except:
1080+
pass
1081+
ds.DefaultSignature(sign_alg, digest_alg)
1082+
10701083
SRV = wsgiserver.CherryPyWSGIServer((HOST, PORT), application)
10711084

10721085
_https = ""

example/idp2/idp_conf.py.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from saml2.saml import NAME_FORMAT_URI
88
from saml2.saml import NAMEID_FORMAT_TRANSIENT
99
from saml2.saml import NAMEID_FORMAT_PERSISTENT
1010
import os.path
11+
import saml2.xmldsig as ds
1112

1213
try:
1314
from saml2.sigver import get_xmlsec_binary
@@ -39,6 +40,11 @@ else:
3940
SERVER_CERT = "pki/mycert.pem"
4041
SERVER_KEY = "pki/mykey.pem"
4142
CERT_CHAIN = ""
43+
SIGN_ALG = None
44+
DIGEST_ALG = None
45+
#SIGN_ALG = ds.SIG_RSA_SHA512
46+
#DIGEST_ALG = ds.DIGEST_SHA512
47+
4248

4349
CONFIG = {
4450
"entityid": "%s/idp.xml" % BASE,

0 commit comments

Comments
 (0)