forked from goauthentik/authentik
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: fix source_flow_manager throwing error when authenticated user …
…attempts to re-authenticate with existing link (goauthentik#12080) Signed-off-by: Jens Langhammer <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -81,6 +81,22 @@ def test_authenticated_link(self): | |
reverse("authentik_core:if-user") + "#/settings;page-sources", | ||
) | ||
|
||
def test_authenticated_auth(self): | ||
"""Test authenticated user linking""" | ||
user = User.objects.create(username="foo", email="[email protected]") | ||
UserOAuthSourceConnection.objects.create( | ||
user=user, source=self.source, identifier=self.identifier | ||
) | ||
request = get_request("/", user=user) | ||
flow_manager = OAuthSourceFlowManager( | ||
self.source, request, self.identifier, {"info": {}}, {} | ||
) | ||
action, connection = flow_manager.get_action() | ||
self.assertEqual(action, Action.AUTH) | ||
self.assertIsNotNone(connection.pk) | ||
response = flow_manager.get_flow() | ||
self.assertEqual(response.status_code, 302) | ||
|
||
def test_unauthenticated_link(self): | ||
"""Test un-authenticated user linking""" | ||
flow_manager = OAuthSourceFlowManager( | ||
|