{"action":"closed","issue":{"url":"https://api.github.com/repos/google/oauth2client/issues/564","repository_url":"https://api.github.com/repos/google/oauth2client","labels_url":"https://api.github.com/repos/google/oauth2client/issues/564/labels{/name}","comments_url":"https://api.github.com/repos/google/oauth2client/issues/564/comments","events_url":"https://api.github.com/repos/google/oauth2client/issues/564/events","html_url":"https://github.com/google/oauth2client/issues/564","id":167137498,"number":564,"title":"Refactor Credentials","user":{"login":"pferate","id":468011,"avatar_url":"https://avatars.githubusercontent.com/u/468011?v=3","gravatar_id":"","url":"https://api.github.com/users/pferate","html_url":"https://github.com/pferate","followers_url":"https://api.github.com/users/pferate/followers","following_url":"https://api.github.com/users/pferate/following{/other_user}","gists_url":"https://api.github.com/users/pferate/gists{/gist_id}","starred_url":"https://api.github.com/users/pferate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pferate/subscriptions","organizations_url":"https://api.github.com/users/pferate/orgs","repos_url":"https://api.github.com/users/pferate/repos","events_url":"https://api.github.com/users/pferate/events{/privacy}","received_events_url":"https://api.github.com/users/pferate/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/oauth2client/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/google/oauth2client/labels/hygiene","name":"hygiene","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"nathanielmanistaatgoogle","id":10131044,"avatar_url":"https://avatars.githubusercontent.com/u/10131044?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielmanistaatgoogle","html_url":"https://github.com/nathanielmanistaatgoogle","followers_url":"https://api.github.com/users/nathanielmanistaatgoogle/followers","following_url":"https://api.github.com/users/nathanielmanistaatgoogle/following{/other_user}","gists_url":"https://api.github.com/users/nathanielmanistaatgoogle/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielmanistaatgoogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielmanistaatgoogle/subscriptions","organizations_url":"https://api.github.com/users/nathanielmanistaatgoogle/orgs","repos_url":"https://api.github.com/users/nathanielmanistaatgoogle/repos","events_url":"https://api.github.com/users/nathanielmanistaatgoogle/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielmanistaatgoogle/received_events","type":"User","site_admin":false},"assignees":[{"login":"nathanielmanistaatgoogle","id":10131044,"avatar_url":"https://avatars.githubusercontent.com/u/10131044?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielmanistaatgoogle","html_url":"https://github.com/nathanielmanistaatgoogle","followers_url":"https://api.github.com/users/nathanielmanistaatgoogle/followers","following_url":"https://api.github.com/users/nathanielmanistaatgoogle/following{/other_user}","gists_url":"https://api.github.com/users/nathanielmanistaatgoogle/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielmanistaatgoogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielmanistaatgoogle/subscriptions","organizations_url":"https://api.github.com/users/nathanielmanistaatgoogle/orgs","repos_url":"https://api.github.com/users/nathanielmanistaatgoogle/repos","events_url":"https://api.github.com/users/nathanielmanistaatgoogle/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielmanistaatgoogle/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-07-22T21:37:22Z","updated_at":"2016-08-04T19:39:41Z","closed_at":"2016-08-04T19:39:41Z","body":"This started out as a thought to refactoring `oauth2client.service_account.ServiceAccountCredentials` into `oauth2client.service_account.Credentials`.  Now I'm thinking that it may be better to refactor all of the built-in credentials and get all of the `contrib` Credentials in the same format, but I wanted to see what everyone thought of this.\r\n\r\nWith PR #556 cleaning up the internal namespace, there will now be a smaller chance for name collisions.\r\n\r\nA brief look at Credentials currently: (cleaning up output a bit)\r\n```bash\r\n~/Projects/oauth2client$ git grep \"^class \" oauth2client | grep Credentials\r\noauth2client/client.py:class Credentials(object):\r\noauth2client/client.py:class OAuth2Credentials(Credentials):\r\noauth2client/client.py:class AccessTokenCredentials(OAuth2Credentials):\r\noauth2client/client.py:class GoogleCredentials(OAuth2Credentials):\r\noauth2client/client.py:class AssertionCredentials(GoogleCredentials):\r\noauth2client/service_account.py:class ServiceAccountCredentials(client.AssertionCredentials):\r\noauth2client/service_account.py:class _JWTAccessCredentials(ServiceAccountCredentials):\r\n\r\noauth2client/contrib/appengine.py:class AppAssertionCredentials(client.AssertionCredentials):\r\noauth2client/contrib/devshell.py:class DevshellCredentials(client.GoogleCredentials):\r\noauth2client/contrib/gce.py:class AppAssertionCredentials(client.AssertionCredentials):\r\n```\r\n\r\nI propose that we move all of the built-in Credential classes into a `credentials` module like:\r\n```\r\noauth2client/credentials.py:class Base(object):\r\noauth2client/credentials.py:class OAuth2(Base):\r\noauth2client/credentials.py:class AccessToken(OAuth2):\r\noauth2client/credentials.py:class Google(OAuth2):\r\noauth2client/credentials.py:class Assertion(Google):\r\noauth2client/credentials.py:class ServiceAccount(Assertion):\r\noauth2client/credentials.py:class _JWTAccess(ServiceAccount):\r\n```\r\n\r\nAnd have all contrib Credentials are named `Credentials` and inherit from their appropriate base credential class.\r\n```\r\noauth2client/contrib/appengine.py:class Credentials(credentials.Assertion):\r\noauth2client/contrib/devshell.py:class Credentials(credentials.Google):\r\noauth2client/contrib/gce.py:class Credentials(credentials.Assertion):\r\n```\r\n\r\nObviously, this would be a major change, but I wanted to get your thoughts on this.\r\n\r\nTo maintain the current external interfaces, we can define the following in `oauth2client/client.py`:\r\n```python\r\nCredentials = credentials.Base\r\nOAuth2Credentials = credentials.OAuth2\r\nAccessTokenCredentials = credentials.AccessToken\r\nGoogleCredentials = credentials.Google\r\nAssertionCredentials = credentials.Assertion\r\n```"}}
{"actor":{"display_login":"jonparrott"}}