-
Notifications
You must be signed in to change notification settings - Fork 430
Conversation
# limitations under the License. | ||
|
||
"""Pure python crypto-related routines for oauth2client.""" | ||
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Looks mostly really good. |
@nathanielmanistaatgoogle Addressed review comments (with some remarks) and also added a commit to remove the old service account implementation (as well as to use |
@nathanielmanistaatgoogle FYI https://bitbucket.org/ned/coveragepy/issues/473/context-manager-confuses-branch-miss is causing |
@nathanielmanistaatgoogle It'd be nice to use
|
Args: | ||
service_account_email: string, The email associated with the | ||
service account. | ||
private_key_pkcs8_pem: bytes, The content of a PKCS#8 key in PEM |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
As for what I think about making |
I also wanted to discuss the fact that this implementation double-stores Here is a quick rundown of everything in
|
@nathanielmanistaatgoogle I'm fine with have three factories ( |
@nathanielmanistaatgoogle We should also discuss how to break this up. I think the first two PRs could be
|
|
||
@classmethod | ||
def from_string(cls, key, password='notasecret'): | ||
"""Construct a Signer instance from a string. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
is expected to be an RSA key in PEM format. | ||
|
||
Returns: | ||
Verifier instance. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Responding to "I also wanted to discuss the fact that this implementation double-stores scopes and shadows lots of fields from the parent that are unused": my first reaction is "grumble grumble public classes grumble grumble implementation inheritance grumble grumble cuss words cuss words", but that's not productive. So my second reaction is: that's just kind of a thing that happens with deep inheritance hierarchies, but does any of it negatively effect either the implementation complexity or the correctness of the particular leaf class currently under review? |
Responding to "Is the reason for this just an aversion to allowing multiple types in a function signature?": yes. In my experience ad-hoc polymorphism always harms the long-term maintenance of a codebase and should be avoided wherever it can be avoided. |
Responding to "We should also discuss how to break this up": that does sound like a good plan. Certainly "introduce new code in its own commit" is a winning first step. Why break the system tests? Would it just be a matter of changing the out-of-repository artifacts of those tests at the same time as changing the in-repository artifacts of those tests? |
@nathanielmanistaatgoogle Pushed a new commit to address the docstring issues and to remove RE: Breaking system tests, I just meant that if we have a commit where |
Responding to: "if we have a commit where client.SignedJWTCredentials is deleted and ServiceAccountCredentials doesn't support .p12 keys, then the system test corresponding to a .p12 key can't be run" - that would be an intermediate commit, right? ... and we don't even care if tests pass at intermediate commit points, only at head-of-pull-request and head-of-repository, right? |
Well my plan was for 4 PRs, not 4 commits. You can break it up as you like, not worth discussing with 4 posts (which we've done already). |
Ah, okay. I have no objection to four pull requests if that's your preference. Thank you for the clarity. |
# this non-top-level import. | ||
from oauth2client.service_account import _ServiceAccountCredentials | ||
data = json.loads(_from_bytes(s)) | ||
# this non-top-level import. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Using the crypt module as the rest of the library does.
034c908
to
46b942b
Compare
Attempt at #211 (and integrating changes from #1 in as well).
@nathanielmanistaatgoogle This doesn't implement the scope-less credentials yet but I wanted you to get a chance to look at it before then. I am going to remove the
SignedJwtAssertionCredentials
class and will probably update this PR when that is done as well.