Fixing filter generation when no filter file is present in the server
This commit is contained in:
parent
a91abb36f3
commit
61b982607e
|
@ -32,35 +32,31 @@ def getSSOFilters():
|
|||
"""
|
||||
import glob
|
||||
from ConfigParser import ConfigParser
|
||||
import json
|
||||
try:
|
||||
filters = {}
|
||||
filters = { 'uid': "uid", "mail": "mail" }
|
||||
filterDirectory = "/usr/share/sso/app_filters/"
|
||||
filterExtention = ".ini"
|
||||
filterSection = "utilisateur"
|
||||
filterFiles = glob.glob("{0}/*{1}".format(filterDirectory, filterExtention))
|
||||
toClean = ["uid","mail","cn","__name__"]
|
||||
toClean = [ "__name__" ]
|
||||
if len(filterFiles) != 0:
|
||||
for fi in filterFiles:
|
||||
# Don't parse "applications.ini"
|
||||
config = ConfigParser()
|
||||
config.read(fi)
|
||||
if filterSection in config._sections:
|
||||
filters.update(config._sections[filterSection].items())
|
||||
|
||||
for key in toClean:
|
||||
if key in filters.keys():
|
||||
del(filters[key])
|
||||
|
||||
res = ""
|
||||
index=0
|
||||
size=len(filters)
|
||||
for k,v in filters.items():
|
||||
res += " \"{0}\": \"{1}\",".format(k,v)
|
||||
res += " \"{0}\": \"{1}\"".format(k,v)
|
||||
index += 1
|
||||
if index != size:
|
||||
res += "\n"
|
||||
|
||||
res += ",\n"
|
||||
return(res)
|
||||
|
||||
except:
|
||||
return "Error Generating Filters"
|
||||
|
||||
|
|
|
@ -159,12 +159,10 @@
|
|||
"ldapUsePasswordResetAttribute": 1,
|
||||
"ldapPpolicyControl": 0,
|
||||
"casAttributes": {
|
||||
"uid":"uid",
|
||||
%%getSSOFilters
|
||||
%for att in %%casAttribute
|
||||
"%%att": "%%att.casLDAPAttribute",
|
||||
%end for
|
||||
"mail":"mail"
|
||||
%%getSSOFilters
|
||||
},
|
||||
"issuerDBSAMLPath": "^/saml/",
|
||||
"samlAttributeAuthorityDescriptorAttributeServiceSOAP": "urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/AA/SOAP;",
|
||||
|
|
Loading…
Reference in New Issue