Skip to content

Commit e80fd8e

Browse files
author
Hans Hörberg
committed
Example for LDAP, new error message and added a test user.
1 parent ab301ad commit e80fd8e

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

example/idp2/idp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,9 @@ def do_authentication(environ, start_response, authn_context, key,
484484

485485
# -----------------------------------------------------------------------------
486486

487-
PASSWD = {"haho0032": "qwerty",
487+
PASSWD = {
488+
"daev0001": "qwerty",
489+
"haho0032": "qwerty",
488490
"roland": "dianakra",
489491
"babs": "howes",
490492
"upper": "crust"}

example/idp2/idp_user.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,45 @@
1-
USERS = {
1+
#from dirg_util.dict import LDAPDict
2+
#ldap_settings = {
3+
# "ldapuri": "ldaps://ldap.test.umu.se",
4+
# "base": "dc=umu, dc=se",
5+
# "filter_pattern": "(uid=%s)",
6+
# "user": "",
7+
# "passwd": "",
8+
# "attr": [
9+
# "eduPersonScopedAffiliation",
10+
# "eduPersonAffiliation",
11+
# "eduPersonPrincipalName",
12+
# "givenName",
13+
# "sn",
14+
# "mail",
15+
# "uid",
16+
# "o",
17+
# "c",
18+
# "labeledURI",
19+
# "ou",
20+
# "displayName",
21+
# "norEduPersonLIN"
22+
# ],
23+
# "keymap": {
24+
# "mail": "email",
25+
# "labeledURI": "labeledURL",
26+
# },
27+
# "static_values": {
28+
# "eduPersonTargetedID": "one!for!all",
29+
# },
30+
# "exact_match": True,
31+
# "firstonly_len1": True,
32+
# "timeout": 15,
33+
#}
34+
#Uncomment to use a LDAP directory instead.
35+
#USERS = LDAPDict(**ldap_settings)
36+
37+
USERS_ = {
238
"haho0032": {
339
"sn": "Hoerberg",
4-
"givenName": "Hans",
5-
"eduPersonScopedAffiliation": "[email protected]",
40+
"givenName": "Hasse",
41+
"eduPersonAffiliation": "student",
42+
"eduPersonScopedAffiliation": "[email protected]",
643
"eduPersonPrincipalName": "[email protected]",
744
"uid": "haho",
845
"eduPersonTargetedID": "one!for!all",

src/saml2/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ def create_authn_response(self, identity, in_response_to, destination,
479479
if not verify_encrypt_cert(encrypt_cert):
480480
raise CertificateError("Invalid certificate for encryption!")
481481
else:
482-
raise CertificateError("No certificate for encryption!")
482+
raise CertificateError("No SPCertEncType certificate for encryption contained in authentication "
483+
"request.")
483484
else:
484485
encrypt_assertion = False
485486

0 commit comments

Comments
 (0)