sources/saml: set username field to name_id attribute
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
c7ea4b5a7f
commit
6ea57921f2
|
@ -216,6 +216,7 @@ class ResponseProcessor:
|
||||||
# Flatten all lists in the dict
|
# Flatten all lists in the dict
|
||||||
for key, value in attributes.items():
|
for key, value in attributes.items():
|
||||||
attributes[key] = BaseEvaluator.expr_flatten(value)
|
attributes[key] = BaseEvaluator.expr_flatten(value)
|
||||||
|
attributes["username"] = self._get_name_id().text
|
||||||
return attributes
|
return attributes
|
||||||
|
|
||||||
def prepare_flow_manager(self) -> SourceFlowManager:
|
def prepare_flow_manager(self) -> SourceFlowManager:
|
||||||
|
|
|
@ -109,4 +109,7 @@ class TestResponseProcessor(TestCase):
|
||||||
parser = ResponseProcessor(self.source, request)
|
parser = ResponseProcessor(self.source, request)
|
||||||
parser.parse()
|
parser.parse()
|
||||||
sfm = parser.prepare_flow_manager()
|
sfm = parser.prepare_flow_manager()
|
||||||
self.assertEqual(sfm.enroll_info, {"email": "foo@bar.baz", "name": "foo", "sn": "bar"})
|
self.assertEqual(
|
||||||
|
sfm.enroll_info,
|
||||||
|
{"email": "foo@bar.baz", "name": "foo", "sn": "bar", "username": "jens@beryju.org"},
|
||||||
|
)
|
||||||
|
|
Reference in New Issue