Skip to content

Commit 4110175

Browse files
committed
Fix for 151 empty internal attributes from LDAP store
Fix for 151 "Can internal response attributes have emptyvalues?". With this fix the LDAP attribute store will no longer set an internal attribute to be an empty list when the corresponding LDAP attribute returned with the record is empty.
1 parent e9ba69d commit 4110175

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
@@ -167,8 +167,11 @@ def process(self, context, data):
167167
# Populate attributes as configured.
168168
for attr in search_return_attributes.keys():
169169
if attr in record["attributes"]:
170-
data.attributes[search_return_attributes[attr]] = record["attributes"][attr]
171-
satosa_logging(logger, logging.DEBUG, "{} Setting internal attribute {} with values {}".format(logprefix, search_return_attributes[attr], record["attributes"][attr]), context.state)
170+
if record["attributes"][attr]:
171+
data.attributes[search_return_attributes[attr]] = record["attributes"][attr]
172+
satosa_logging(logger, logging.DEBUG, "{} Setting internal attribute {} with values {}".format(logprefix, search_return_attributes[attr], record["attributes"][attr]), context.state)
173+
else:
174+
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)
172175

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

0 commit comments

Comments
 (0)