This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix grandfathering of SAML users #8855
Merged
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3f73a5a
Add basic SAML tests.
clokep 3949b58
Install xmlsec1 for pysaml2.
clokep bb06478
Remove some bits of the tests that were copied from OIDC.
clokep d0f9b9a
Merge remote-tracking branch 'origin/develop' into clokep/saml-tests
clokep 003b25e
Add an additional test for generating in-use usernames.
clokep 9179256
Fix a left-over OIDC term.
clokep 1de016a
Update comments.
clokep 6a58182
Remove unused HTTP code.
clokep ef2e79f
Use singletons for handlers.
clokep 1ab9ad1
Use default_config method.
clokep 837bbf9
Update changelog.
clokep 6b1ac9a
Lint.
clokep 6b77f3e
Remove an unused parameter.
clokep 57cd3b9
Add a test.
clokep d80f070
Fix mapping of legacy SAML users.
clokep 063fd8b
Do not duplicate an attribute from BaseHandler.
clokep 3e7626c
Merge remote-tracking branch 'origin/develop' into clokep/grandfather…
clokep 4fa146e
Revert "Do not duplicate an attribute from BaseHandler."
clokep 6e0c95c
Handle review comment.
clokep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add additional error checking for OpenID Connect and SAML mapping providers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add support for re-trying generation of a localpart for OpenID Connect mapping providers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,10 +265,10 @@ async def saml_response_to_remapped_user_attributes( | |
return UserAttributes( | ||
localpart=result.get("mxid_localpart"), | ||
display_name=result.get("displayname"), | ||
emails=result.get("emails"), | ||
emails=result.get("emails", []), | ||
) | ||
|
||
with (await self._mapping_lock.queue(self._auth_provider_id)): | ||
async def grandfather_existing_users() -> Optional[str]: | ||
# backwards-compatibility hack: see if there is an existing user with a | ||
# suitable mapping from the uid | ||
if ( | ||
|
@@ -290,17 +290,18 @@ async def saml_response_to_remapped_user_attributes( | |
if users: | ||
registered_user_id = list(users.keys())[0] | ||
logger.info("Grandfathering mapping to %s", registered_user_id) | ||
await self.store.record_user_external_id( | ||
self._auth_provider_id, remote_user_id, registered_user_id | ||
) | ||
return registered_user_id | ||
|
||
return None | ||
|
||
with (await self._mapping_lock.queue(self._auth_provider_id)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this lock should be moved into |
||
return await self._sso_handler.get_mxid_from_sso( | ||
self._auth_provider_id, | ||
remote_user_id, | ||
user_agent, | ||
ip_address, | ||
saml_response_to_remapped_user_attributes, | ||
grandfather_existing_users, | ||
) | ||
|
||
def expire_sessions(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I'd rather we went in the opposite direction: removing the stuff that relies on BaseHandler, and removing the inheritance from it. But 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on this I can back out the change.