Skip to content

Commit

Permalink
oidc: display error msg when signing in via username password (PROJQU…
Browse files Browse the repository at this point in the history
…AY-6740) (quay#2714)

* oidc: display error msg when signing in via username password (PROJQUAY-6740)

* added test + typo fix
  • Loading branch information
Sunandadadi authored Mar 1, 2024
1 parent b6c6f00 commit 3446d56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions data/users/externaloidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ def is_superuser(self, username: str):

def verify_credentials(self, username_or_email, password):
"""
Verify the credentials with OIDC: To Implement
Unsupported to login via username/email and password
"""
pass
return (
None,
f"Unsupported login option. Please sign in with the configured {self._federated_service} provider",
)

def check_group_lookup_args(self, group_lookup_args, disable_pagination=False):
"""
Expand Down
8 changes: 8 additions & 0 deletions test/test_external_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,11 @@ def test_sync_user_groups_for_empty_user_obj(self):
self.oidc_instance.sync_user_groups(user_groups, user_obj, self.oidc_login_service)
user_teams_after_sync = TeamMember.select().where(TeamMember.user == user_obj).count()
assert user_teams_before_sync == user_teams_after_sync

def test_verify_credentials(self):
result, error_msg = self.oidc_instance.verify_credentials("username", "password")
assert result is None
assert (
error_msg
== "Unsupported login option. Please sign in with the configured oidc provider"
)

0 comments on commit 3446d56

Please sign in to comment.