summaryrefslogtreecommitdiffstats
path: root/virtualenv/pffedportal
diff options
context:
space:
mode:
authorThomas NOEL <tnoel@entrouvert.com>2012-07-12 12:42:28 (GMT)
committerThomas NOEL <tnoel@entrouvert.com>2012-07-12 12:42:28 (GMT)
commitc8cb74395184a74d899e1d9911d68b7a7717b582 (patch)
tree9d3c99ff212fcf1fe01981b409a06f4b1b468d09 /virtualenv/pffedportal
parent65c5cf66c1a1d4ed72989d3bdb5dad08f265b03b (diff)
downloadunivnautes-old-c8cb74395184a74d899e1d9911d68b7a7717b582.zip
univnautes-old-c8cb74395184a74d899e1d9911d68b7a7717b582.tar.gz
univnautes-old-c8cb74395184a74d899e1d9911d68b7a7717b582.tar.bz2
disco: webadmin interface
Diffstat (limited to 'virtualenv/pffedportal')
-rw-r--r--virtualenv/pffedportal/base/views.py2
-rw-r--r--virtualenv/pffedportal/settings.py15
-rw-r--r--virtualenv/pffedportal/templates/login0.html28
3 files changed, 38 insertions, 7 deletions
diff --git a/virtualenv/pffedportal/base/views.py b/virtualenv/pffedportal/base/views.py
index 7b7ac33..a668884 100644
--- a/virtualenv/pffedportal/base/views.py
+++ b/virtualenv/pffedportal/base/views.py
@@ -106,6 +106,8 @@ def login(request):
'idp_providers': get_idp_list_sorted(),
'mailform': mailform,
'https_hostname': settings.HTTPS_HOSTNAME,
+ 'disco_stores_read': settings.DISCO_STORES_READ,
+ 'disco_stores_write': settings.DISCO_STORES_WRITE,
},
context_instance=RequestContext(request))
diff --git a/virtualenv/pffedportal/settings.py b/virtualenv/pffedportal/settings.py
index 4d915ba..404ddde 100644
--- a/virtualenv/pffedportal/settings.py
+++ b/virtualenv/pffedportal/settings.py
@@ -219,6 +219,21 @@ try:
except:
SESSION_COOKIE_AGE = 15*60
+# discovery service
+try:
+ stores = root.find('installedpackages/univnautes/config/discostoresread').text.decode('base64').decode('iso-8859-1').splitlines()
+ DISCO_STORES_READ = [ l for l in stores if not re.match('^\s*$', l) ]
+except:
+ DISCO_STORES_READ = [ 'https://' + HTTPS_HOSTNAME + MEDIA_URL + 'simple-disco-store/store.html' ]
+
+try:
+ stores = root.find('installedpackages/univnautes/config/discostoreswrite').text.decode('base64').decode('iso-8859-1').splitlines()
+ DISCO_STORES_WRITE = [ l for l in stores if not re.match('^\s*$', l) ]
+ if not DISCO_STORES_WRITE:
+ DISCO_STORES_WRITE = DISCO_STORES_READ
+except:
+ DISCO_STORES_WRITE = DISCO_STORES_READ
+
# After login, redirect the user to the original requested URL after this delay (in seconds).
# 0 = immediate redirection
# -1 = no redirection
diff --git a/virtualenv/pffedportal/templates/login0.html b/virtualenv/pffedportal/templates/login0.html
index d43f467..1641f85 100644
--- a/virtualenv/pffedportal/templates/login0.html
+++ b/virtualenv/pffedportal/templates/login0.html
@@ -52,31 +52,45 @@ Choisissez votre établissement&nbsp;:<br /><br />
<script type="text/javascript" src="{{ MEDIA_URL }}simple-disco-store/debug.js"></script>
<script>
+ idps = {
+ {% for p in idp_providers %}
+ "{{ p.entity_id }}": {
+ name: "{{ p.name }}",
+ href: "/sso?entity_id={{ p.entity_id|urlfullencode }}",
+ },
+ {% endfor %}
+ };
+
function query() {
+ {% for store in disco_stores_read %}
$.disco_query(
"https://{{https_hostname}}/authsaml2/metadata",
- "https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/store.html",
+ "{{ store }}",
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/response.html",
function (entity_id, store, auth) {
- $('a#default-idp').text("entity_id : " + entity_id);
+ idp = idps[entity_id];
+ // alert("idp = " + JSON.stringify(idp));
+ $('a#default-idp').text(idp.name);
$('a#default-idp').attr({
- href: "/sso?entity_id=" + entity_id,
- title: "Entity ID = " + entity_id,
+ href: idp.href,
+ title: "Authentification via " + idp.name,
style: "",
});
- alert("query: receive " + entity_id + " from " + store);
});
+ {% endfor %}
}
function set(idp_entity_id) {
+ {% for store in disco_stores_write %}
$.disco_set(
"https://{{https_hostname}}/authsaml2/metadata",
idp_entity_id,
- "https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/store.html",
+ "{{ store }}",
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/response.html",
function (entity_id, store, auth) {
- alert("set: store " + entity_id + " on " + store);
+ // alert("set: store " + entity_id + " on " + store);
});
+ {% endfor %}
}
$(document).ready(function() {