Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 3, 2023
1 parent 0f99ad0 commit 352ad44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 6 additions & 2 deletions oauthenticator/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ async def check_allowed(self, username, auth_model):

if self.hosted_domain:
if user_domain not in self.hosted_domain:
self.log.error(f"Google OAuth unauthorized domain attempt: {user_email}")
raise HTTPError(403, f"Google account domain @{user_domain} not authorized")
self.log.error(
f"Google OAuth unauthorized domain attempt: {user_email}"
)
raise HTTPError(
403, f"Google account domain @{user_domain} not authorized"
)

# if allowed_users or allowed_google_groups is configured, we deny users not part of either
if self.allowed_users or self.allowed_google_groups:
Expand Down
5 changes: 1 addition & 4 deletions oauthenticator/tests/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ async def test_admin_google_groups(google_client):
'_google_groups_for_user',
lambda *args: ['anotherone', 'fakegroup'],
):
allowed_user_info = await authenticator.get_authenticated_user(
handler,
None
)
allowed_user_info = await authenticator.get_authenticated_user(handler, None)
allowed_user_groups = allowed_user_info['auth_state']['google_user'][
'google_groups'
]
Expand Down

0 comments on commit 352ad44

Please sign in to comment.