{"action":"created","issue":{"url":"https://api.github.com/repos/grpc/grpc/issues/3765","labels_url":"https://api.github.com/repos/grpc/grpc/issues/3765/labels{/name}","comments_url":"https://api.github.com/repos/grpc/grpc/issues/3765/comments","events_url":"https://api.github.com/repos/grpc/grpc/issues/3765/events","html_url":"https://github.com/grpc/grpc/pull/3765","id":110747146,"number":3765,"title":"Core credentials API refactoring","user":{"login":"jboeuf","id":6262765,"avatar_url":"https://avatars.githubusercontent.com/u/6262765?v=3","gravatar_id":"","url":"https://api.github.com/users/jboeuf","html_url":"https://github.com/jboeuf","followers_url":"https://api.github.com/users/jboeuf/followers","following_url":"https://api.github.com/users/jboeuf/following{/other_user}","gists_url":"https://api.github.com/users/jboeuf/gists{/gist_id}","starred_url":"https://api.github.com/users/jboeuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jboeuf/subscriptions","organizations_url":"https://api.github.com/users/jboeuf/orgs","repos_url":"https://api.github.com/users/jboeuf/repos","events_url":"https://api.github.com/users/jboeuf/events{/privacy}","received_events_url":"https://api.github.com/users/jboeuf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/grpc/grpc/labels/API%20BREAKAGE","name":"API BREAKAGE","color":"e11d21"},{"url":"https://api.github.com/repos/grpc/grpc/labels/cla:%20yes","name":"cla: yes","color":"009800"},{"url":"https://api.github.com/repos/grpc/grpc/labels/core","name":"core","color":"006b75"},{"url":"https://api.github.com/repos/grpc/grpc/labels/DO%20NOT%20MERGE","name":"DO NOT MERGE","color":"e11d21"},{"url":"https://api.github.com/repos/grpc/grpc/labels/security","name":"security","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"ctiller","id":10120821,"avatar_url":"https://avatars.githubusercontent.com/u/10120821?v=3","gravatar_id":"","url":"https://api.github.com/users/ctiller","html_url":"https://github.com/ctiller","followers_url":"https://api.github.com/users/ctiller/followers","following_url":"https://api.github.com/users/ctiller/following{/other_user}","gists_url":"https://api.github.com/users/ctiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ctiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctiller/subscriptions","organizations_url":"https://api.github.com/users/ctiller/orgs","repos_url":"https://api.github.com/users/ctiller/repos","events_url":"https://api.github.com/users/ctiller/events{/privacy}","received_events_url":"https://api.github.com/users/ctiller/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/grpc/grpc/milestones/35","html_url":"https://github.com/grpc/grpc/milestones/GA","labels_url":"https://api.github.com/repos/grpc/grpc/milestones/35/labels","id":1207499,"number":35,"title":"GA","description":"","creator":{"login":"nicolasnoble","id":7281574,"avatar_url":"https://avatars.githubusercontent.com/u/7281574?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasnoble","html_url":"https://github.com/nicolasnoble","followers_url":"https://api.github.com/users/nicolasnoble/followers","following_url":"https://api.github.com/users/nicolasnoble/following{/other_user}","gists_url":"https://api.github.com/users/nicolasnoble/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasnoble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasnoble/subscriptions","organizations_url":"https://api.github.com/users/nicolasnoble/orgs","repos_url":"https://api.github.com/users/nicolasnoble/repos","events_url":"https://api.github.com/users/nicolasnoble/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasnoble/received_events","type":"User","site_admin":false},"open_issues":144,"closed_issues":44,"state":"open","created_at":"2015-07-14T17:46:14Z","updated_at":"2015-10-26T21:45:11Z","due_on":null,"closed_at":null},"comments":14,"created_at":"2015-10-09T22:36:20Z","updated_at":"2015-10-27T00:51:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/grpc/grpc/pulls/3765","html_url":"https://github.com/grpc/grpc/pull/3765","diff_url":"https://github.com/grpc/grpc/pull/3765.diff","patch_url":"https://github.com/grpc/grpc/pull/3765.patch"},"body":"As part of having all the gRPC libraries be consistent, we would like to make a breaking change to the current credentials API.\r\n\r\n# Motivation\r\n\r\nThe idea coming from @murgatroid99 is that there are now 2 credentials classes, one for channels (grpc_channel_credentials) to be set on a channel and the other one on calls (grpc_call_credentials). We still have composition functions that do:\r\n`channel_creds <- compose(channel_creds, call_creds)`\r\n`call_creds <- compose(call_creds, call_creds)`\r\n\r\nThis refactoring will achieve 2 main goals:\r\n\r\n1. Add some type safety so that users of the API do not set call credentials only (without a channel one) when creating a channel. Likewise, this will make it impossible to set channel creds on a particular call which is currently just a runtime error.\r\n\r\n2. This will also cleanup a lot of the implementation that basically had to provide at runtime for what the type safety was not enforcing.\r\n\r\n# API breakage\r\n\r\nIn terms of API breakage, this translate into the following changes:\r\n\r\n## C (core)\r\n\r\n### Objects\r\n `grpc_credentials` is now replaced by `grpc_channel_credentials` for channels and `grpc_call_credentials` for calls.\r\n\r\n### Factory Functions \r\n`grpc_ssl_credentials(...)` and `grpc_google_default_credentials(...)` return a `grpc_channel_credentials *` and the rest of the credentials factories exposed in `grpc_security.h` return a `grpc_call_credentials *`.\r\n\r\nFor composition we now have the following functions instead of `grpc_composite_credentials_create`:\r\n```c\r\ngrpc_channel_credentials *grpc_composite_channel_credentials_create(\r\n    grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds);\r\n\r\ngrpc_call_credentials *grpc_composite_call_credentials_create(\r\n    grpc_call_credentials *creds1, grpc_call_credentials *creds2);\r\n```\r\n\r\n## C++\r\n\r\n### Objects\r\n`credentials.h` now contains `ChannelCredentials` and `CallCredentials` respectively for channel and client credentials. \r\n\r\n### Factory Functions\r\n`SslCredentials(...)` , `GoogleDefaultCredentials(...)` and `InsecureChannelCredentials(...)` now return a `std::shared_ptr<ChannelCredentials>`. The rest of the factory functions return a `std::shared_ptr<CallCredentials>`.\r\n\r\nFor composition we now have the following functions instead of `CompositeCredentials()`:\r\n```cpp\r\nstd::shared_ptr<ChannelCredentials> CompositeChannelCredentials(\r\n    const std::shared_ptr<ChannelCredentials>& channel_creds,\r\n    const std::shared_ptr<CallCredentials>& call_creds);\r\n\r\nstd::shared_ptr<CallCredentials> CompositeCalllCredentials(\r\n    const std::shared_ptr<CallCredentials>& creds1,\r\n    const std::shared_ptr<CallCredentials>& creds2);\r\n```\r\n\r\nNote that `InsecureCredentials()` has been renamed `InsecureChannelCredentials()` and we foresee (based on our changes in the tests) this particular API breakage to be the most painful for our user base.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/grpc/grpc/issues/comments/151327870","html_url":"https://github.com/grpc/grpc/pull/3765#issuecomment-151327870","issue_url":"https://api.github.com/repos/grpc/grpc/issues/3765","id":151327870,"user":{"login":"murgatroid99","id":961599,"avatar_url":"https://avatars.githubusercontent.com/u/961599?v=3","gravatar_id":"","url":"https://api.github.com/users/murgatroid99","html_url":"https://github.com/murgatroid99","followers_url":"https://api.github.com/users/murgatroid99/followers","following_url":"https://api.github.com/users/murgatroid99/following{/other_user}","gists_url":"https://api.github.com/users/murgatroid99/gists{/gist_id}","starred_url":"https://api.github.com/users/murgatroid99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murgatroid99/subscriptions","organizations_url":"https://api.github.com/users/murgatroid99/orgs","repos_url":"https://api.github.com/users/murgatroid99/repos","events_url":"https://api.github.com/users/murgatroid99/events{/privacy}","received_events_url":"https://api.github.com/users/murgatroid99/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T00:50:59Z","updated_at":"2015-10-27T00:50:59Z","body":"I sent jboeuf/grpc#3 and stanley sent jboeuf/grpc#4."}}