From 25eabadd68c09a28185a402de2d61aef84ba99ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Ho=CC=88rberg?= Date: Tue, 13 May 2014 08:45:27 +0200 Subject: [PATCH] Added the possibility to change host and port. Added the possibility to change host and port in the configuration file. This is needed for the raspberry install scripts. --- example/idp2/idp.py | 7 ++++--- example/idp2/idp_conf.py.example | 7 ++++--- example/idp2/idp_user.py | 4 ++-- example/sp-repoze/sp.py | 6 +++--- example/sp-repoze/sp_conf.example | 6 ++++-- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/example/idp2/idp.py b/example/idp2/idp.py index 5670104..93dde7c 100755 --- a/example/idp2/idp.py +++ b/example/idp2/idp.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +import importlib import argparse import base64 import re @@ -983,7 +984,7 @@ AUTHN_BROKER.add(authn_context_class_ref(PASSWORD), "http://%s" % socket.gethostname()) AUTHN_BROKER.add(authn_context_class_ref(UNSPECIFIED), "", 0, "http://%s" % socket.gethostname()) - +CONFIG = importlib.import_module(args.config) IDP = server.Server(args.config, cache=Cache()) IDP.ticket = {} @@ -1013,8 +1014,8 @@ if __name__ == '__main__': module_directory=_rot + 'modules', input_encoding='utf-8', output_encoding='utf-8') - HOST = '127.0.0.1' - PORT = 8088 + HOST = CONFIG.HOST + PORT = CONFIG.PORT SRV = make_server(HOST, PORT, application) print "IdP listening on %s:%s" % (HOST, PORT) diff --git a/example/idp2/idp_conf.py.example b/example/idp2/idp_conf.py.example index 6fd8714..6928b1e 100644 --- a/example/idp2/idp_conf.py.example +++ b/example/idp2/idp_conf.py.example @@ -25,9 +25,10 @@ BASEDIR = os.path.abspath(os.path.dirname(__file__)) def full_path(local_file): return os.path.join(BASEDIR, local_file) -#BASE = "http://lingon.ladok.umu.se:8088" -#BASE = "http://lingon.catalogix.se:8088" -BASE = "http://localhost:8088" +HOST = 'localhost' +PORT = 8088 + +BASE = "http://%s:%s" % (HOST, PORT) CONFIG = { "entityid": "%s/idp.xml" % BASE, diff --git a/example/idp2/idp_user.py b/example/idp2/idp_user.py index ee64624..588f351 100644 --- a/example/idp2/idp_user.py +++ b/example/idp2/idp_user.py @@ -34,14 +34,14 @@ #Uncomment to use a LDAP directory instead. #USERS = LDAPDict(**ldap_settings) -USERS_ = { +USERS = { "haho0032": { "sn": "Hoerberg", "givenName": "Hasse", "eduPersonAffiliation": "student", "eduPersonScopedAffiliation": "student@example.com", "eduPersonPrincipalName": "haho@example.com", - "uid": "haho", + "uid": "haho0032", "eduPersonTargetedID": "one!for!all", "c": "SE", "o": "Example Co.", diff --git a/example/sp-repoze/sp.py b/example/sp-repoze/sp.py index a0af4e7..f02933f 100755 --- a/example/sp-repoze/sp.py +++ b/example/sp-repoze/sp.py @@ -2,7 +2,7 @@ from Cookie import SimpleCookie import logging import os - +import sp_conf from sp_conf import CONFIG import re import subprocess @@ -268,8 +268,8 @@ app_with_auth = make_middleware_with_config(application, {"here": "."}, log_file="repoze_who.log") # ---------------------------------------------------------------------------- -HOST = '127.0.0.1' -PORT = 8087 +HOST = sp_conf.HOST +PORT = sp_conf.PORT # allow uwsgi or gunicorn mount # by moving some initialization out of __name__ == '__main__' section. diff --git a/example/sp-repoze/sp_conf.example b/example/sp-repoze/sp_conf.example index 5d244ac..df808b6 100644 --- a/example/sp-repoze/sp_conf.example +++ b/example/sp-repoze/sp_conf.example @@ -1,8 +1,10 @@ from saml2 import BINDING_HTTP_REDIRECT from saml2.saml import NAME_FORMAT_URI -BASE= "http://localhost:8087" -#BASE= "http://lingon.catalogix.se:8087" +HOST = 'localhost' +PORT = 8087 + +BASE = "http://%s:%s" % (HOST, PORT) CONFIG = { "entityid": "%s/sp.xml" % BASE,