diff options
-rw-r--r-- | coip/apps/saml2/views.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/coip/apps/saml2/views.py b/coip/apps/saml2/views.py index c6c9846..2fcde4f 100644 --- a/coip/apps/saml2/views.py +++ b/coip/apps/saml2/views.py @@ -14,16 +14,22 @@ from saml2.metadata import entity_descriptor from saml2.saml import NAME_FORMAT_URI from django.conf import settings +def get_full_path(request,path=None): + if path == None: + path = request.path + full_path = ('http', ('', 's')[request.is_secure()], '://', request.META['HTTP_HOST'], path) + return ''.join(full_path) + def _config(request): host = request.get_host().replace(":","-") c = { - "entityid" : request.build_absolute_uri("/saml2/entity"), + "entityid" : get_full_path(request,"/saml2/entity"), "description": "COIP", "service": { "aa": { "name" : "COIP", "endpoints" : { - "attribute_service" : [(request.build_absolute_uri("/saml2/aq"), BINDING_SOAP)], + "attribute_service" : [(get_full_path(request,"/saml2/aq"), BINDING_SOAP)], }, "policy": { "default": { @@ -45,7 +51,7 @@ def _config(request): "organization": { "display_name": "COIP on %s" % host, "name": "COIP on %s" % host, - "url": request.build_absolute_uri("/"), + "url": get_full_path(request,"/"), }, } return c |