Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Commit 034c908

Browse files
committed
Addressing review comments.
1 parent b59ac6e commit 034c908

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

oauth2client/_pure_python_crypt.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ def verify(self, message, signature):
9494

9595
@classmethod
9696
def from_string(cls, key_pem, is_x509_cert):
97-
"""Construct a Verified instance from a string.
97+
"""Construct an RsaVerifier instance from a string.
9898
9999
Args:
100100
key_pem: string, public key in PEM format.
101101
is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it
102102
is expected to be an RSA key in PEM format.
103103
104104
Returns:
105-
Verifier instance.
105+
RsaVerifier instance.
106106
107107
Raises:
108108
ValueError: if the key_pem can't be parsed. In either case, error
@@ -150,18 +150,19 @@ def sign(self, message):
150150

151151
@classmethod
152152
def from_string(cls, key, password='notasecret'):
153-
"""Construct a Signer instance from a string.
153+
"""Construct an RsaSigner instance from a string.
154154
155155
Args:
156156
key: string, private key in PEM format.
157157
password: string, password for private key file. Unused for PEM
158158
files.
159159
160160
Returns:
161-
Signer instance.
161+
RsaSigner instance.
162162
163163
Raises:
164-
NotImplementedError if the key isn't in PEM format.
164+
ValueError if the key cannot be parsed as PKCS#1 or PKCS#8 in
165+
PEM format.
165166
"""
166167
key = _from_bytes(key) # pem expects str in Py3
167168
marker_id, key_bytes = pem.readPemBlocksFromFile(

oauth2client/service_account.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ class ServiceAccountCredentials(AssertionCredentials):
134134
will be ``foo.apps.googleusercontent.com``.
135135
user_agent: string, (Optional) User agent to use when sending
136136
request.
137-
_token_uri: string, (Optional) The URI to use when requesting an
138-
access token.
139-
_revoke_uri: string, (Optional) The URI to use when revoking an
140-
access token.
141137
kwargs: dict, Extra key-value pairs (both strings) to send in the
142138
payload body when making an assertion.
143139
@@ -167,13 +163,10 @@ def __init__(self,
167163
private_key_id=None,
168164
service_account_id=None,
169165
user_agent=None,
170-
_token_uri=GOOGLE_TOKEN_URI,
171-
_revoke_uri=GOOGLE_REVOKE_URI,
172166
**kwargs):
173167

174168
super(ServiceAccountCredentials, self).__init__(
175-
None, user_agent=user_agent, token_uri=_token_uri,
176-
revoke_uri=_revoke_uri)
169+
None, user_agent=user_agent)
177170

178171
self._service_account_email = service_account_email
179172
self._private_key_pkcs8_pem = private_key_pkcs8_pem
@@ -325,12 +318,12 @@ def from_json(cls, json_str):
325318
private_key_id=data['_private_key_id'],
326319
service_account_id=data['_service_account_id'],
327320
user_agent=data['_user_agent'],
328-
_token_uri=data['token_uri'],
329-
_revoke_uri=data['revoke_uri'],
330321
**data['_kwargs']
331322
)
332323
credentials.invalid = data['invalid']
333324
credentials.access_token = data['access_token']
325+
credentials.token_uri = data['token_uri']
326+
credentials.revoke_uri = data['revoke_uri']
334327
token_expiry = data.get('token_expiry', None)
335328
if token_expiry is not None:
336329
credentials.token_expiry = datetime.datetime.strptime(

0 commit comments

Comments
 (0)