Skip to content

Conversation

@Neitsch
Copy link

@Neitsch Neitsch commented Apr 17, 2021

Implements my request from #44 . SAML_USERS_LOOKUP_ATTRIBUTE[1] can now be a callable. That allows to construct more complex values for the user id based on multiple attributes if needed.

Unfortunately no tests cover this part of the code.

@Neitsch Neitsch changed the title Allow v[1] to be callable Allow SAML_USERS_LOOKUP_ATTRIBUTE[1] to be callable Apr 17, 2021
Copy link
Member

@shepdelacreme shepdelacreme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty straightforward. I left a few comments. Can you add some documentation around the callable and how to use this?

lookup_res = lookup_val(saml_auth, final_map)
else:
lookup_map = {lookup_attr[0]: final_map[lookup_attr[1]]}
final_map[lookup_val]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be assigning final_map[lookup_val] to lookup_res?

if lookup_val == "NameId":
lookup_res = saml_auth.get_nameid()
elif callable(lookup_val):
lookup_res = lookup_val(saml_auth, final_map)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the callable will have a standard signature. Can we get this documented and an example added for how to use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants