From eef533bfe693c6a6d46d31d5f0b111360d7d3286 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Mon, 9 Apr 2018 14:31:35 +0200 Subject: [PATCH] Using exportedVars key names in casAttributes We need tu use the key name of exportedVars in casAttributes to make attr availlable --- creolefuncs/lemonldap.py | 9 +++++++-- tmpl/lmConf-1.js | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/creolefuncs/lemonldap.py b/creolefuncs/lemonldap.py index b812c7d..e2e62b5 100644 --- a/creolefuncs/lemonldap.py +++ b/creolefuncs/lemonldap.py @@ -32,6 +32,7 @@ def getSSOFilters(): """ import glob from ConfigParser import ConfigParser + try: filters = { 'uid': "uid", "mail": "mail" } filterDirectory = "/usr/share/sso/app_filters/" @@ -49,14 +50,18 @@ def getSSOFilters(): for key in toClean: if key in filters.keys(): del(filters[key]) - res = "" + res = {} index=0 size=len(filters) + return(filters.items()) + """ for k,v in filters.items(): - res += " \"{0}\": \"{1}\"".format(k,v) + res[k] " \"{0}\": \"{1}\"".format(k,v) index += 1 if index != size: res += ",\n" return(res) + """ except: return "Error Generating Filters" + diff --git a/tmpl/lmConf-1.js b/tmpl/lmConf-1.js index cc77f47..a447560 100644 --- a/tmpl/lmConf-1.js +++ b/tmpl/lmConf-1.js @@ -1,3 +1,4 @@ +%set %%ssoFilters = %%getSSOFilters { "ldapGroupAttributeNameUser": "dn", "cfgAuthorIP": "172.16.0.1", @@ -67,9 +68,18 @@ "exportedVars": { "UA": "HTTP_USER_AGENT", %for att in %%casAttribute - "%%att": "%%att.casLDAPAttribute", + "%%att": "%%att", +%end for +%set %%idx = 0 +%set %%size = %%len(%%ssoFilters) - 1 +%for key,value in %%ssoFilters + %if %%idx == %%size + "%%key": "%%value" + %else + "%%key": "%%value", + %end if + %set %%idx += 1 %end for -%%getSSOFilters }, "notificationStorage": "File", "applicationList": { @@ -168,7 +178,16 @@ %for att in %%casAttribute "%%att": "%%att.casLDAPAttribute", %end for -%%getSSOFilters +%set %%idx = 0 +%set %%size = %%len(%%ssoFilters) - 1 +%for key,value in %%ssoFilters + %if %%idx == %%size + "%%key": "%%key" + %else + "%%key": "%%key", + %end if + %set %%idx += 1 +%end for }, "issuerDBSAMLPath": "^/saml/", "samlAttributeAuthorityDescriptorAttributeServiceSOAP": "urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/AA/SOAP;",