Skip to content
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

Revert "feat: send quota project id in x-goog-user-project for OAuth2 credentials" #407

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions docs/reference/google.auth.crypt.base.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/reference/google.auth.crypt.rsa.rst

This file was deleted.

19 changes: 0 additions & 19 deletions google/oauth2/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(
client_id=None,
client_secret=None,
scopes=None,
quota_project_id=None,
):
"""
Args:
Expand All @@ -82,9 +81,6 @@ def __init__(
token if refresh information is provided (e.g. The refresh
token scopes are a superset of this or contain a wild card
scope like 'https://www.googleapis.com/auth/any-api').
quota_project_id (Optional[str]): The project ID used for quota and billing.
This project may be different from the project used to
create the credentials.
"""
super(Credentials, self).__init__()
self.token = token
Expand All @@ -94,7 +90,6 @@ def __init__(
self._token_uri = token_uri
self._client_id = client_id
self._client_secret = client_secret
self._quota_project_id = quota_project_id

@property
def refresh_token(self):
Expand Down Expand Up @@ -128,11 +123,6 @@ def client_secret(self):
"""Optional[str]: The OAuth 2.0 client secret."""
return self._client_secret

@property
def quota_project_id(self):
"""Optional[str]: The project to use for quota and billing purposes."""
return self._quota_project_id

@property
def requires_scopes(self):
"""False: OAuth 2.0 credentials have their scopes set when
Expand Down Expand Up @@ -179,12 +169,6 @@ def refresh(self, request):
)
)

@_helpers.copy_docstring(credentials.Credentials)
def apply(self, headers, token=None):
super(Credentials, self).apply(headers, token=token)
if self.quota_project_id is not None:
headers["x-goog-user-project"] = self.quota_project_id

@classmethod
def from_authorized_user_info(cls, info, scopes=None):
"""Creates a Credentials instance from parsed authorized user info.
Expand Down Expand Up @@ -218,9 +202,6 @@ def from_authorized_user_info(cls, info, scopes=None):
scopes=scopes,
client_id=info["client_id"],
client_secret=info["client_secret"],
quota_project_id=info.get(
"quota_project_id"
), # quota project may not exist
)

@classmethod
Expand Down
27 changes: 0 additions & 27 deletions tests/oauth2/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,33 +294,6 @@ def test_credentials_with_scopes_refresh_failure_raises_refresh_error(
# expired.)
assert creds.valid

def test_apply_with_quota_project_id(self):
creds = credentials.Credentials(
token="token",
refresh_token=self.REFRESH_TOKEN,
token_uri=self.TOKEN_URI,
client_id=self.CLIENT_ID,
client_secret=self.CLIENT_SECRET,
quota_project_id="quota-project-123",
)

headers = {}
creds.apply(headers)
assert headers["x-goog-user-project"] == "quota-project-123"

def test_apply_with_no_quota_project_id(self):
creds = credentials.Credentials(
token="token",
refresh_token=self.REFRESH_TOKEN,
token_uri=self.TOKEN_URI,
client_id=self.CLIENT_ID,
client_secret=self.CLIENT_SECRET,
)

headers = {}
creds.apply(headers)
assert "x-goog-user-project" not in headers

def test_from_authorized_user_info(self):
info = AUTH_USER_INFO.copy()

Expand Down