-
Notifications
You must be signed in to change notification settings - Fork 416
Add passthrough_authorization_parameters support to OIDC configuration #18232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d67b6d5
Add support for the `login_hint` parameter in OIDC authentication flow
odelcroi a3d8668
rename feature log
odelcroi 2b63ce4
Merge branch 'develop' into add_login_hint
odelcroi c02e747
Merge branch 'develop' into add_login_hint
odelcroi 6f87069
Merge branch 'develop' into add_login_hint
odelcroi dabcdc5
Merge branch 'develop' into add_login_hint
odelcroi d6c7dfe
add passthrough_authorization_parameters to oidc config
odelcroi ab4c555
Merge branch 'develop' into add_login_hint
odelcroi cc0537e
update changelog
odelcroi 539edc8
lint
odelcroi 92b4617
update changelog
odelcroi 2268623
Update docs/usage/configuration/config_documentation.md
odelcroi 6c80e5a
Update docs/usage/configuration/config_documentation.md
odelcroi 6510d43
Merge branch 'develop' into add_login_hint
odelcroi 5b44af1
remove login_hint docs
odelcroi 47307c1
Merge branch 'develop' into add_login_hint
odelcroi 13073da
Merge branch 'develop' into add_login_hint
odelcroi 0aed597
Update changelog.d/18232.feature
odelcroi 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 hidden or 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 the `login_hint` parameter in OIDC authentication flow to pre-fill user identification. |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ | |
| CALLBACK_URL = BASE_URL + "_synapse/client/oidc/callback" | ||
| TEST_REDIRECT_URI = "https://test/oidc/callback" | ||
| SCOPES = ["openid"] | ||
| LOGIN_HINT = "[email protected]" | ||
|
|
||
| # config for common cases | ||
| DEFAULT_CONFIG = { | ||
|
|
@@ -439,8 +440,10 @@ def test_skip_verification(self) -> None: | |
| @override_config({"oidc_config": DEFAULT_CONFIG}) | ||
| def test_redirect_request(self) -> None: | ||
| """The redirect request has the right arguments & generates a valid session cookie.""" | ||
| req = Mock(spec=["cookies"]) | ||
| req = Mock(spec=["cookies", "args"]) | ||
| req.cookies = [] | ||
| req.args = {} | ||
| req.args[b"login_hint"] = [LOGIN_HINT.encode("utf-8")] | ||
|
|
||
| url = urlparse( | ||
| self.get_success( | ||
|
|
@@ -461,6 +464,8 @@ def test_redirect_request(self) -> None: | |
| self.assertEqual(len(params["state"]), 1) | ||
| self.assertEqual(len(params["nonce"]), 1) | ||
| self.assertNotIn("code_challenge", params) | ||
| # Verify that login_hint is properly set | ||
| self.assertEqual(params["login_hint"], [LOGIN_HINT]) | ||
|
|
||
| # Check what is in the cookies | ||
| self.assertEqual(len(req.cookies), 2) # two cookies | ||
|
|
@@ -487,8 +492,9 @@ def test_redirect_request(self) -> None: | |
| @override_config({"oidc_config": DEFAULT_CONFIG}) | ||
| def test_redirect_request_with_code_challenge(self) -> None: | ||
| """The redirect request has the right arguments & generates a valid session cookie.""" | ||
| req = Mock(spec=["cookies"]) | ||
| req = Mock(spec=["cookies", "args"]) | ||
| req.cookies = [] | ||
| req.args = {} | ||
|
|
||
| with self.metadata_edit({"code_challenge_methods_supported": ["S256"]}): | ||
| url = urlparse( | ||
|
|
@@ -522,8 +528,9 @@ def test_redirect_request_with_code_challenge(self) -> None: | |
| @override_config({"oidc_config": {**DEFAULT_CONFIG, "pkce_method": "always"}}) | ||
| def test_redirect_request_with_forced_code_challenge(self) -> None: | ||
| """The redirect request has the right arguments & generates a valid session cookie.""" | ||
| req = Mock(spec=["cookies"]) | ||
| req = Mock(spec=["cookies", "args"]) | ||
| req.cookies = [] | ||
| req.args = {} | ||
|
|
||
| url = urlparse( | ||
| self.get_success( | ||
|
|
@@ -554,8 +561,9 @@ def test_redirect_request_with_forced_code_challenge(self) -> None: | |
| @override_config({"oidc_config": {**DEFAULT_CONFIG, "pkce_method": "never"}}) | ||
| def test_redirect_request_with_disabled_code_challenge(self) -> None: | ||
| """The redirect request has the right arguments & generates a valid session cookie.""" | ||
| req = Mock(spec=["cookies"]) | ||
| req = Mock(spec=["cookies", "args"]) | ||
| req.cookies = [] | ||
| req.args = {} | ||
|
|
||
| # The metadata should state that PKCE is enabled. | ||
| with self.metadata_edit({"code_challenge_methods_supported": ["S256"]}): | ||
|
|
@@ -592,8 +600,9 @@ def test_redirect_request_with_disabled_code_challenge(self) -> None: | |
| ) | ||
| def test_redirect_request_with_overridden_redirect_uri(self) -> None: | ||
| """The authorization endpoint redirect has the overridden `redirect_uri` value.""" | ||
| req = Mock(spec=["cookies"]) | ||
| req = Mock(spec=["cookies", "args"]) | ||
| req.cookies = [] | ||
| req.args = {} | ||
|
|
||
| url = urlparse( | ||
| self.get_success( | ||
|
|
||
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.
This would be an extension of the spec, which should go through the spec change process. Given that it's unlikely that such a spec change would land, I think it would make sense to instead have a generic option to 'passthrough' specific query parameters.
Something like
And then passthrough any query parameter passed to
/_matrix/client/v3/login/sso/redirectto the OIDC authorization requestUh oh!
There was an error while loading. Please reload this page.
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.
thanks for your inputs, makes sense, I've made the corresponding changes