Skip to content

Commit 7a07eb2

Browse files
Merge pull request #153 from skoranda/empty_internal_attribute
Fix for 151 empty internal attributes from LDAP store
2 parents d205001 + 4110175 commit 7a07eb2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/satosa/micro_services/ldap_attribute_store.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,11 @@ def process(self, context, data):
212212
# Populate attributes as configured.
213213
for attr in search_return_attributes.keys():
214214
if attr in record["attributes"]:
215-
data.attributes[search_return_attributes[attr]] = record["attributes"][attr]
216-
satosa_logging(logger, logging.DEBUG, "{} Setting internal attribute {} with values {}".format(logprefix, search_return_attributes[attr], record["attributes"][attr]), context.state)
215+
if record["attributes"][attr]:
216+
data.attributes[search_return_attributes[attr]] = record["attributes"][attr]
217+
satosa_logging(logger, logging.DEBUG, "{} Setting internal attribute {} with values {}".format(logprefix, search_return_attributes[attr], record["attributes"][attr]), context.state)
218+
else:
219+
satosa_logging(logger, logging.DEBUG, "{} Not setting internal attribute {} because value {} is null or empty".format(logprefix, search_return_attributes[attr], record["attributes"][attr]), context.state)
217220

218221
# Populate input for NameID if configured. SATOSA core does the hashing of input
219222
# to create a persistent NameID.

0 commit comments

Comments
 (0)