Using exportedVars key names in casAttributes

We need tu use the key name of exportedVars in casAttributes to make
attr availlable
This commit is contained in:
Philippe Caseiro 2018-04-09 14:31:35 +02:00
parent e84ba19b68
commit eef533bfe6
2 changed files with 29 additions and 5 deletions

View File

@ -32,6 +32,7 @@ def getSSOFilters():
""" """
import glob import glob
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
try: try:
filters = { 'uid': "uid", "mail": "mail" } filters = { 'uid': "uid", "mail": "mail" }
filterDirectory = "/usr/share/sso/app_filters/" filterDirectory = "/usr/share/sso/app_filters/"
@ -49,14 +50,18 @@ def getSSOFilters():
for key in toClean: for key in toClean:
if key in filters.keys(): if key in filters.keys():
del(filters[key]) del(filters[key])
res = "" res = {}
index=0 index=0
size=len(filters) size=len(filters)
return(filters.items())
"""
for k,v in filters.items(): for k,v in filters.items():
res += " \"{0}\": \"{1}\"".format(k,v) res[k] " \"{0}\": \"{1}\"".format(k,v)
index += 1 index += 1
if index != size: if index != size:
res += ",\n" res += ",\n"
return(res) return(res)
"""
except: except:
return "Error Generating Filters" return "Error Generating Filters"

View File

@ -1,3 +1,4 @@
%set %%ssoFilters = %%getSSOFilters
{ {
"ldapGroupAttributeNameUser": "dn", "ldapGroupAttributeNameUser": "dn",
"cfgAuthorIP": "172.16.0.1", "cfgAuthorIP": "172.16.0.1",
@ -67,9 +68,18 @@
"exportedVars": { "exportedVars": {
"UA": "HTTP_USER_AGENT", "UA": "HTTP_USER_AGENT",
%for att in %%casAttribute %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 %end for
%%getSSOFilters
}, },
"notificationStorage": "File", "notificationStorage": "File",
"applicationList": { "applicationList": {
@ -168,7 +178,16 @@
%for att in %%casAttribute %for att in %%casAttribute
"%%att": "%%att.casLDAPAttribute", "%%att": "%%att.casLDAPAttribute",
%end for %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/", "issuerDBSAMLPath": "^/saml/",
"samlAttributeAuthorityDescriptorAttributeServiceSOAP": "urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/AA/SOAP;", "samlAttributeAuthorityDescriptorAttributeServiceSOAP": "urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/AA/SOAP;",