Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2225)

Unified Diff: appengine/findit/common/auth_util.py

Issue 2611723002: Moved http_client_appengine.py from ./common to ./gae_libs/http (Closed)
Patch Set: adding missing __init__.py file Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/findit/common/base_handler.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/common/auth_util.py
diff --git a/appengine/findit/common/auth_util.py b/appengine/findit/common/auth_util.py
deleted file mode 100644
index 33383890b12595943c8175f8158e7521463cf3f8..0000000000000000000000000000000000000000
--- a/appengine/findit/common/auth_util.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-from google.appengine.api import oauth
-from google.appengine.api import users
-from google.appengine.api.app_identity import app_identity
-
-
-_EMAIL_SCOPE = 'https://www.googleapis.com/auth/userinfo.email'
-
-
-def GetAuthToken(scope=_EMAIL_SCOPE): # pragma: no cover
- """Gets auth token for requests to hosts that need authorizations."""
- auth_token, _ = app_identity.get_access_token(scope)
- return auth_token
-
-
-def GetUserEmail(scope=_EMAIL_SCOPE): # pragma: no cover
- """Returns the email of the logged-in user or None if not logged-in."""
- user = users.get_current_user() # Cookie-based authentication.
- if not user:
- try:
- user = oauth.get_current_user(scope) # Oauth-based authentication.
- except oauth.OAuthRequestError:
- pass # Not logged-in or invalid oauth token.
- return user.email() if user else None
-
-
-def IsCurrentUserAdmin(scope=_EMAIL_SCOPE): # pragma: no cover
- """Returns True if the logged-in user is an admin."""
- is_admin = users.is_current_user_admin()
- try:
- is_admin = is_admin or oauth.is_current_user_admin(scope)
- except oauth.OAuthRequestError:
- pass # Not logged-in or invalid oauth token.
- return is_admin
« no previous file with comments | « no previous file | appengine/findit/common/base_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698