Skip to content

Commit a6ef514

Browse files
author
Roland Hedberg
committed
Merge pull request #117 from HaToHo/master
Some minor changes and a fix to make the raspberry install scripts work better.
2 parents fabb33b + 25eabad commit a6ef514

File tree

6 files changed

+60
-16
lines changed

6 files changed

+60
-16
lines changed

example/idp2/idp.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
import importlib
23
import argparse
34
import base64
45
import re
@@ -484,7 +485,9 @@ def do_authentication(environ, start_response, authn_context, key,
484485

485486
# -----------------------------------------------------------------------------
486487

487-
PASSWD = {"haho0032": "qwerty",
488+
PASSWD = {
489+
"daev0001": "qwerty",
490+
"haho0032": "qwerty",
488491
"roland": "dianakra",
489492
"babs": "howes",
490493
"upper": "crust"}
@@ -981,7 +984,7 @@ def application(environ, start_response):
981984
"http://%s" % socket.gethostname())
982985
AUTHN_BROKER.add(authn_context_class_ref(UNSPECIFIED),
983986
"", 0, "http://%s" % socket.gethostname())
984-
987+
CONFIG = importlib.import_module(args.config)
985988
IDP = server.Server(args.config, cache=Cache())
986989
IDP.ticket = {}
987990

@@ -1011,8 +1014,8 @@ def application(environ, start_response):
10111014
module_directory=_rot + 'modules',
10121015
input_encoding='utf-8', output_encoding='utf-8')
10131016

1014-
HOST = '127.0.0.1'
1015-
PORT = 8088
1017+
HOST = CONFIG.HOST
1018+
PORT = CONFIG.PORT
10161019

10171020
SRV = make_server(HOST, PORT, application)
10181021
print "IdP listening on %s:%s" % (HOST, PORT)

example/idp2/idp_conf.py.example

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ BASEDIR = os.path.abspath(os.path.dirname(__file__))
2525
def full_path(local_file):
2626
return os.path.join(BASEDIR, local_file)
2727

28-
#BASE = "http://lingon.ladok.umu.se:8088"
29-
#BASE = "http://lingon.catalogix.se:8088"
30-
BASE = "http://localhost:8088"
28+
HOST = 'localhost'
29+
PORT = 8088
30+
31+
BASE = "http://%s:%s" % (HOST, PORT)
3132

3233
CONFIG = {
3334
"entityid": "%s/idp.xml" % BASE,

example/idp2/idp_user.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,47 @@
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+
137
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]",
7-
"uid": "haho",
44+
"uid": "haho0032",
845
"eduPersonTargetedID": "one!for!all",
946
"c": "SE",
1047
"o": "Example Co.",

example/sp-repoze/sp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from Cookie import SimpleCookie
33
import logging
44
import os
5-
5+
import sp_conf
66
from sp_conf import CONFIG
77
import re
88
import subprocess
@@ -268,8 +268,8 @@ def application(environ, start_response):
268268
log_file="repoze_who.log")
269269

270270
# ----------------------------------------------------------------------------
271-
HOST = '127.0.0.1'
272-
PORT = 8087
271+
HOST = sp_conf.HOST
272+
PORT = sp_conf.PORT
273273

274274
# allow uwsgi or gunicorn mount
275275
# by moving some initialization out of __name__ == '__main__' section.

example/sp-repoze/sp_conf.example

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from saml2 import BINDING_HTTP_REDIRECT
22
from saml2.saml import NAME_FORMAT_URI
33

4-
BASE= "http://localhost:8087"
5-
#BASE= "http://lingon.catalogix.se:8087"
4+
HOST = 'localhost'
5+
PORT = 8087
6+
7+
BASE = "http://%s:%s" % (HOST, PORT)
68

79
CONFIG = {
810
"entityid": "%s/sp.xml" % BASE,

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)