{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc.github.io/pulls/comments/56155927","id":56155927,"diff_hunk":"@@ -192,6 +192,43 @@ channel = implementations.secure_channel('localhost', 50051, creds)\n stub = helloworld_pb2.beta_create_Greeter_stub(channel)\n ```\n \n+###SSL/TLS for server authentication and encryption (Java)\n+\n+In Java we recommend that you use OpenSSL when using gRPC over TLS. You can find details about installing and using OpenSSL and other required libraries for both Android and non-Android Java in the gRPC Java [Security](https://github.com/grpc/grpc-java/blob/master/SECURITY.md#transport-security-tls) documentation.\n+\n+To enable TLS on a server, a certificate chain and private key need to be specified in PEM format. The standard TLS port is 443, but we use 8443 below to avoid needing extra permissions from the OS.\n+\n+```\n+ServerImpl server = ServerBuilder.forPort(8443)\n+    // Enable TLS\n+    .useTransportSecurity(certChainFile, privateKeyFile)\n+    .addService(TestServiceGrpc.bindService(serviceImplementation))\n+    .build();\n+server.start();\n+```\n+If the issuing certificate authority is not known to the client then a properly configured `SslContext` or `SSLSocketFactory` should be provided to the `NettyChannelBuilder` or `OkHttpChannelBuilder`, respectively.\n+\n+On the client side, server authentication with SSL/TLS looks like this:\n+\n+```\n+// Base case - No encryption\n+ManagedChannel channel = ManagedChannelBuilder.forAddress(\"localhost\", 50051)\n+    .usePlaintext(true)\n+    .build();\n+GreeterGrpc.GreeterStub stub = GreeterGrpc.newStub(channel);\n+\n+// With server authentication SSL/TLS\n+ManagedChannel channel = ManagedChannelBuilder.forAddress(\"localhost\", 50051)\n+    .build();\n+GreeterGrpc.GreeterStub stub = GreeterGrpc.newStub(channel);\n+\n+// With server authentication SSL/TLS; custom CA root certificates; not on Android\n+ManagedChannel channel = NettyChannelBuilder.forAddress(\"localhost\", 50051)\n+    .sslContext(GrpcSslContexts.forClient().trustManager(new File(\"roots.pem\")).build())\n+    .build();\n+GreeterGrpc.GreeterStub stub = GreeterGrpc.newStub(channel);\n+``","path":"docs/guides/auth.md","position":48,"original_position":48,"commit_id":"a09923f90d2c86cd27c1bb54bb85ecb29151a186","original_commit_id":"a09923f90d2c86cd27c1bb54bb85ecb29151a186","user":{"login":"LisaFC","id":10744406,"avatar_url":"https://avatars.githubusercontent.com/u/10744406?v=3","gravatar_id":"","url":"https://api.github.com/users/LisaFC","html_url":"https://github.com/LisaFC","followers_url":"https://api.github.com/users/LisaFC/followers","following_url":"https://api.github.com/users/LisaFC/following{/other_user}","gists_url":"https://api.github.com/users/LisaFC/gists{/gist_id}","starred_url":"https://api.github.com/users/LisaFC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LisaFC/subscriptions","organizations_url":"https://api.github.com/users/LisaFC/orgs","repos_url":"https://api.github.com/users/LisaFC/repos","events_url":"https://api.github.com/users/LisaFC/events{/privacy}","received_events_url":"https://api.github.com/users/LisaFC/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-03-15T12:43:42Z","updated_at":"2016-03-15T12:43:42Z","html_url":"https://github.com/grpc/grpc.github.io/pull/157#discussion_r56155927","pull_request_url":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc.github.io/pulls/comments/56155927"},"html":{"href":"https://github.com/grpc/grpc.github.io/pull/157#discussion_r56155927"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157","id":62789569,"html_url":"https://github.com/grpc/grpc.github.io/pull/157","diff_url":"https://github.com/grpc/grpc.github.io/pull/157.diff","patch_url":"https://github.com/grpc/grpc.github.io/pull/157.patch","issue_url":"https://api.github.com/repos/grpc/grpc.github.io/issues/157","number":157,"state":"open","locked":false,"title":"Added auth examples for Java","user":{"login":"LisaFC","id":10744406,"avatar_url":"https://avatars.githubusercontent.com/u/10744406?v=3","gravatar_id":"","url":"https://api.github.com/users/LisaFC","html_url":"https://github.com/LisaFC","followers_url":"https://api.github.com/users/LisaFC/followers","following_url":"https://api.github.com/users/LisaFC/following{/other_user}","gists_url":"https://api.github.com/users/LisaFC/gists{/gist_id}","starred_url":"https://api.github.com/users/LisaFC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LisaFC/subscriptions","organizations_url":"https://api.github.com/users/LisaFC/orgs","repos_url":"https://api.github.com/users/LisaFC/repos","events_url":"https://api.github.com/users/LisaFC/events{/privacy}","received_events_url":"https://api.github.com/users/LisaFC/received_events","type":"User","site_admin":false},"body":"Content largely from https://github.com/grpc/grpc-java/blob/master/SECURITY.md","created_at":"2016-03-14T17:51:32Z","updated_at":"2016-03-15T12:43:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"764d19698b78b31fe83e9c0f813143f9b19da4b2","assignee":{"login":"ejona86","id":2811396,"avatar_url":"https://avatars.githubusercontent.com/u/2811396?v=3","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc.github.io/issues/157/comments","statuses_url":"https://api.github.com/repos/grpc/grpc.github.io/statuses/a09923f90d2c86cd27c1bb54bb85ecb29151a186","head":{"label":"LisaFC:master","ref":"master","sha":"a09923f90d2c86cd27c1bb54bb85ecb29151a186","user":{"login":"LisaFC","id":10744406,"avatar_url":"https://avatars.githubusercontent.com/u/10744406?v=3","gravatar_id":"","url":"https://api.github.com/users/LisaFC","html_url":"https://github.com/LisaFC","followers_url":"https://api.github.com/users/LisaFC/followers","following_url":"https://api.github.com/users/LisaFC/following{/other_user}","gists_url":"https://api.github.com/users/LisaFC/gists{/gist_id}","starred_url":"https://api.github.com/users/LisaFC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LisaFC/subscriptions","organizations_url":"https://api.github.com/users/LisaFC/orgs","repos_url":"https://api.github.com/users/LisaFC/repos","events_url":"https://api.github.com/users/LisaFC/events{/privacy}","received_events_url":"https://api.github.com/users/LisaFC/received_events","type":"User","site_admin":false},"repo":{"id":52968980,"name":"grpc.github.io","full_name":"LisaFC/grpc.github.io","owner":{"login":"LisaFC","id":10744406,"avatar_url":"https://avatars.githubusercontent.com/u/10744406?v=3","gravatar_id":"","url":"https://api.github.com/users/LisaFC","html_url":"https://github.com/LisaFC","followers_url":"https://api.github.com/users/LisaFC/followers","following_url":"https://api.github.com/users/LisaFC/following{/other_user}","gists_url":"https://api.github.com/users/LisaFC/gists{/gist_id}","starred_url":"https://api.github.com/users/LisaFC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LisaFC/subscriptions","organizations_url":"https://api.github.com/users/LisaFC/orgs","repos_url":"https://api.github.com/users/LisaFC/repos","events_url":"https://api.github.com/users/LisaFC/events{/privacy}","received_events_url":"https://api.github.com/users/LisaFC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LisaFC/grpc.github.io","description":"The grpc.io website. (on GitHub pages)","fork":true,"url":"https://api.github.com/repos/LisaFC/grpc.github.io","forks_url":"https://api.github.com/repos/LisaFC/grpc.github.io/forks","keys_url":"https://api.github.com/repos/LisaFC/grpc.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LisaFC/grpc.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LisaFC/grpc.github.io/teams","hooks_url":"https://api.github.com/repos/LisaFC/grpc.github.io/hooks","issue_events_url":"https://api.github.com/repos/LisaFC/grpc.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/LisaFC/grpc.github.io/events","assignees_url":"https://api.github.com/repos/LisaFC/grpc.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/LisaFC/grpc.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/LisaFC/grpc.github.io/tags","blobs_url":"https://api.github.com/repos/LisaFC/grpc.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LisaFC/grpc.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LisaFC/grpc.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/LisaFC/grpc.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LisaFC/grpc.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/LisaFC/grpc.github.io/languages","stargazers_url":"https://api.github.com/repos/LisaFC/grpc.github.io/stargazers","contributors_url":"https://api.github.com/repos/LisaFC/grpc.github.io/contributors","subscribers_url":"https://api.github.com/repos/LisaFC/grpc.github.io/subscribers","subscription_url":"https://api.github.com/repos/LisaFC/grpc.github.io/subscription","commits_url":"https://api.github.com/repos/LisaFC/grpc.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/LisaFC/grpc.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/LisaFC/grpc.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/LisaFC/grpc.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/LisaFC/grpc.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/LisaFC/grpc.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LisaFC/grpc.github.io/merges","archive_url":"https://api.github.com/repos/LisaFC/grpc.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LisaFC/grpc.github.io/downloads","issues_url":"https://api.github.com/repos/LisaFC/grpc.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/LisaFC/grpc.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/LisaFC/grpc.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/LisaFC/grpc.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LisaFC/grpc.github.io/labels{/name}","releases_url":"https://api.github.com/repos/LisaFC/grpc.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/LisaFC/grpc.github.io/deployments","created_at":"2016-03-02T14:26:23Z","updated_at":"2016-03-02T14:26:25Z","pushed_at":"2016-03-14T17:50:34Z","git_url":"git://github.com/LisaFC/grpc.github.io.git","ssh_url":"git@github.com:LisaFC/grpc.github.io.git","clone_url":"https://github.com/LisaFC/grpc.github.io.git","svn_url":"https://github.com/LisaFC/grpc.github.io","homepage":"","size":852,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"a067c58652f0fc373d479d1d0e64fb7c28056c02","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":30666740,"name":"grpc.github.io","full_name":"grpc/grpc.github.io","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc.github.io","description":"The grpc.io website. (on GitHub pages)","fork":false,"url":"https://api.github.com/repos/grpc/grpc.github.io","forks_url":"https://api.github.com/repos/grpc/grpc.github.io/forks","keys_url":"https://api.github.com/repos/grpc/grpc.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc.github.io/teams","hooks_url":"https://api.github.com/repos/grpc/grpc.github.io/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc.github.io/events","assignees_url":"https://api.github.com/repos/grpc/grpc.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc.github.io/tags","blobs_url":"https://api.github.com/repos/grpc/grpc.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc.github.io/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc.github.io/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc.github.io/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc.github.io/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc.github.io/subscription","commits_url":"https://api.github.com/repos/grpc/grpc.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc.github.io/merges","archive_url":"https://api.github.com/repos/grpc/grpc.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc.github.io/downloads","issues_url":"https://api.github.com/repos/grpc/grpc.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc.github.io/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/grpc/grpc.github.io/deployments","created_at":"2015-02-11T19:55:59Z","updated_at":"2016-03-13T07:48:40Z","pushed_at":"2016-03-15T04:33:08Z","git_url":"git://github.com/grpc/grpc.github.io.git","ssh_url":"git@github.com:grpc/grpc.github.io.git","clone_url":"https://github.com/grpc/grpc.github.io.git","svn_url":"https://github.com/grpc/grpc.github.io","homepage":"","size":64136,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":23,"forks":23,"open_issues":23,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157"},"html":{"href":"https://github.com/grpc/grpc.github.io/pull/157"},"issue":{"href":"https://api.github.com/repos/grpc/grpc.github.io/issues/157"},"comments":{"href":"https://api.github.com/repos/grpc/grpc.github.io/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc.github.io/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc.github.io/statuses/a09923f90d2c86cd27c1bb54bb85ecb29151a186"}}}}