{"action":"created","comment":{"url":"https://api.github.com/repos/amplab/tachyon/pulls/comments/36831393","id":36831393,"diff_hunk":"@@ -0,0 +1,120 @@\n+/*\n+ * Licensed to the University of California, Berkeley under one or more contributor license\n+ * agreements. See the NOTICE file distributed with this work for additional information regarding\n+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance with the License. You may obtain a\n+ * copy of the License at\n+ * \n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ * \n+ * Unless required by applicable law or agreed to in writing, software distributed under the License\n+ * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n+ * or implied. See the License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package tachyon.security;\n+\n+import java.io.IOException;\n+import javax.security.auth.callback.Callback;\n+import javax.security.auth.callback.CallbackHandler;\n+import javax.security.auth.callback.NameCallback;\n+import javax.security.auth.callback.PasswordCallback;\n+import javax.security.auth.callback.UnsupportedCallbackException;\n+import javax.security.sasl.RealmCallback;\n+\n+import org.junit.Assert;\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.rules.ExpectedException;\n+\n+public class PlainClientCallbackHandlerTest {\n+\n+  @Rule\n+  public ExpectedException mThrown = ExpectedException.none();\n+\n+  @Test\n+  public void clientCallbackHandlerTest() throws Exception {\n+\n+    Callback[] callbacks = new Callback[2];\n+    callbacks[0] = new NameCallback(\"Username:\");\n+    callbacks[1] = new PasswordCallback(\"Password:\", true);\n+\n+    String user = \"tachyon-user-1\";\n+    String password = \"tachyon-user-1-password\";\n+\n+    CallbackHandler clientCBHandler =\n+        new PlainSaslHelper.PlainClientCallbackHandler(user, password);\n+    clientCBHandler.handle(callbacks);\n+\n+    validateCallbacks(user, password, callbacks);\n+  }\n+\n+  @Test\n+  public void unsupportCallbackTest() throws Exception {\n+\n+    mThrown.expect(UnsupportedCallbackException.class);\n+    mThrown.expectMessage(RealmCallback.class + \" is unsupported.\");\n+\n+    Callback[] callbacks = new Callback[3];\n+    callbacks[0] = new NameCallback(\"Username:\");\n+    callbacks[1] = new PasswordCallback(\"Password:\", true);\n+    callbacks[2] = new RealmCallback(\"Realm:\");\n+\n+    String user = \"tachyon-user-2\";\n+    String password = \"tachyon-user-2-password\";\n+    CallbackHandler clientCBHandler =\n+        new PlainSaslHelper.PlainClientCallbackHandler(user, password);\n+    clientCBHandler.handle(callbacks);\n+\n+    validateCallbacks(user, password, callbacks);","path":"common/src/test/java/tachyon/security/PlainClientCallbackHandlerTest.java","position":70,"original_position":70,"commit_id":"617a802c89a4e0ac2e9bd887ee33c4afea2010f5","original_commit_id":"617a802c89a4e0ac2e9bd887ee33c4afea2010f5","user":{"login":"ooq","id":5876435,"avatar_url":"https://avatars.githubusercontent.com/u/5876435?v=3","gravatar_id":"","url":"https://api.github.com/users/ooq","html_url":"https://github.com/ooq","followers_url":"https://api.github.com/users/ooq/followers","following_url":"https://api.github.com/users/ooq/following{/other_user}","gists_url":"https://api.github.com/users/ooq/gists{/gist_id}","starred_url":"https://api.github.com/users/ooq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooq/subscriptions","organizations_url":"https://api.github.com/users/ooq/orgs","repos_url":"https://api.github.com/users/ooq/repos","events_url":"https://api.github.com/users/ooq/events{/privacy}","received_events_url":"https://api.github.com/users/ooq/received_events","type":"User","site_admin":false},"body":"Guess we don't need this line.","created_at":"2015-08-12T07:00:57Z","updated_at":"2015-08-12T07:00:57Z","html_url":"https://github.com/amplab/tachyon/pull/1241#discussion_r36831393","pull_request_url":"https://api.github.com/repos/amplab/tachyon/pulls/1241","_links":{"self":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/comments/36831393"},"html":{"href":"https://github.com/amplab/tachyon/pull/1241#discussion_r36831393"},"pull_request":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1241"}}},"pull_request":{"url":"https://api.github.com/repos/amplab/tachyon/pulls/1241","id":41763670,"html_url":"https://github.com/amplab/tachyon/pull/1241","diff_url":"https://github.com/amplab/tachyon/pull/1241.diff","patch_url":"https://github.com/amplab/tachyon/pull/1241.patch","issue_url":"https://api.github.com/repos/amplab/tachyon/issues/1241","number":1241,"state":"open","locked":false,"title":"[TACHYON-621] Enable Client PLAIN Authentication","user":{"login":"sundapeng","id":3818001,"avatar_url":"https://avatars.githubusercontent.com/u/3818001?v=3","gravatar_id":"","url":"https://api.github.com/users/sundapeng","html_url":"https://github.com/sundapeng","followers_url":"https://api.github.com/users/sundapeng/followers","following_url":"https://api.github.com/users/sundapeng/following{/other_user}","gists_url":"https://api.github.com/users/sundapeng/gists{/gist_id}","starred_url":"https://api.github.com/users/sundapeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sundapeng/subscriptions","organizations_url":"https://api.github.com/users/sundapeng/orgs","repos_url":"https://api.github.com/users/sundapeng/repos","events_url":"https://api.github.com/users/sundapeng/events{/privacy}","received_events_url":"https://api.github.com/users/sundapeng/received_events","type":"User","site_admin":false},"body":"Jira: https://tachyon.atlassian.net/browse/TACHYON-621\r\n\r\nThis patch is about Enable Client PLAIN Authentication, including adding Plain Client Transport and callback handler in client side.\r\n\r\nRelated jira: [TACHYON-726](https://tachyon.atlassian.net/browse/TACHYON-726) Add methods of creating TTransport","created_at":"2015-08-06T08:36:52Z","updated_at":"2015-08-12T07:00:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9b7c64a848926634d0a4301280bdc50c62b7e24","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amplab/tachyon/pulls/1241/commits","review_comments_url":"https://api.github.com/repos/amplab/tachyon/pulls/1241/comments","review_comment_url":"https://api.github.com/repos/amplab/tachyon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amplab/tachyon/issues/1241/comments","statuses_url":"https://api.github.com/repos/amplab/tachyon/statuses/617a802c89a4e0ac2e9bd887ee33c4afea2010f5","head":{"label":"sundapeng:TACHYON-621","ref":"TACHYON-621","sha":"617a802c89a4e0ac2e9bd887ee33c4afea2010f5","user":{"login":"sundapeng","id":3818001,"avatar_url":"https://avatars.githubusercontent.com/u/3818001?v=3","gravatar_id":"","url":"https://api.github.com/users/sundapeng","html_url":"https://github.com/sundapeng","followers_url":"https://api.github.com/users/sundapeng/followers","following_url":"https://api.github.com/users/sundapeng/following{/other_user}","gists_url":"https://api.github.com/users/sundapeng/gists{/gist_id}","starred_url":"https://api.github.com/users/sundapeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sundapeng/subscriptions","organizations_url":"https://api.github.com/users/sundapeng/orgs","repos_url":"https://api.github.com/users/sundapeng/repos","events_url":"https://api.github.com/users/sundapeng/events{/privacy}","received_events_url":"https://api.github.com/users/sundapeng/received_events","type":"User","site_admin":false},"repo":{"id":39428718,"name":"tachyon","full_name":"sundapeng/tachyon","owner":{"login":"sundapeng","id":3818001,"avatar_url":"https://avatars.githubusercontent.com/u/3818001?v=3","gravatar_id":"","url":"https://api.github.com/users/sundapeng","html_url":"https://github.com/sundapeng","followers_url":"https://api.github.com/users/sundapeng/followers","following_url":"https://api.github.com/users/sundapeng/following{/other_user}","gists_url":"https://api.github.com/users/sundapeng/gists{/gist_id}","starred_url":"https://api.github.com/users/sundapeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sundapeng/subscriptions","organizations_url":"https://api.github.com/users/sundapeng/orgs","repos_url":"https://api.github.com/users/sundapeng/repos","events_url":"https://api.github.com/users/sundapeng/events{/privacy}","received_events_url":"https://api.github.com/users/sundapeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sundapeng/tachyon","description":" A Reliable Memory Centric Distributed Storage System","fork":true,"url":"https://api.github.com/repos/sundapeng/tachyon","forks_url":"https://api.github.com/repos/sundapeng/tachyon/forks","keys_url":"https://api.github.com/repos/sundapeng/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sundapeng/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sundapeng/tachyon/teams","hooks_url":"https://api.github.com/repos/sundapeng/tachyon/hooks","issue_events_url":"https://api.github.com/repos/sundapeng/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/sundapeng/tachyon/events","assignees_url":"https://api.github.com/repos/sundapeng/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/sundapeng/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/sundapeng/tachyon/tags","blobs_url":"https://api.github.com/repos/sundapeng/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sundapeng/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sundapeng/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/sundapeng/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sundapeng/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/sundapeng/tachyon/languages","stargazers_url":"https://api.github.com/repos/sundapeng/tachyon/stargazers","contributors_url":"https://api.github.com/repos/sundapeng/tachyon/contributors","subscribers_url":"https://api.github.com/repos/sundapeng/tachyon/subscribers","subscription_url":"https://api.github.com/repos/sundapeng/tachyon/subscription","commits_url":"https://api.github.com/repos/sundapeng/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/sundapeng/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/sundapeng/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/sundapeng/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/sundapeng/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/sundapeng/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sundapeng/tachyon/merges","archive_url":"https://api.github.com/repos/sundapeng/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sundapeng/tachyon/downloads","issues_url":"https://api.github.com/repos/sundapeng/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/sundapeng/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/sundapeng/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/sundapeng/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sundapeng/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/sundapeng/tachyon/releases{/id}","created_at":"2015-07-21T06:40:32Z","updated_at":"2015-07-21T06:40:34Z","pushed_at":"2015-08-12T02:18:56Z","git_url":"git://github.com/sundapeng/tachyon.git","ssh_url":"git@github.com:sundapeng/tachyon.git","clone_url":"https://github.com/sundapeng/tachyon.git","svn_url":"https://github.com/sundapeng/tachyon","homepage":"http://tachyon-project.org","size":15340,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"amplab:security","ref":"security","sha":"3dbaab04deeb257f65863c95787bde726f5f8dee","user":{"login":"amplab","id":1438454,"avatar_url":"https://avatars.githubusercontent.com/u/1438454?v=3","gravatar_id":"","url":"https://api.github.com/users/amplab","html_url":"https://github.com/amplab","followers_url":"https://api.github.com/users/amplab/followers","following_url":"https://api.github.com/users/amplab/following{/other_user}","gists_url":"https://api.github.com/users/amplab/gists{/gist_id}","starred_url":"https://api.github.com/users/amplab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amplab/subscriptions","organizations_url":"https://api.github.com/users/amplab/orgs","repos_url":"https://api.github.com/users/amplab/repos","events_url":"https://api.github.com/users/amplab/events{/privacy}","received_events_url":"https://api.github.com/users/amplab/received_events","type":"Organization","site_admin":false},"repo":{"id":7276954,"name":"tachyon","full_name":"amplab/tachyon","owner":{"login":"amplab","id":1438454,"avatar_url":"https://avatars.githubusercontent.com/u/1438454?v=3","gravatar_id":"","url":"https://api.github.com/users/amplab","html_url":"https://github.com/amplab","followers_url":"https://api.github.com/users/amplab/followers","following_url":"https://api.github.com/users/amplab/following{/other_user}","gists_url":"https://api.github.com/users/amplab/gists{/gist_id}","starred_url":"https://api.github.com/users/amplab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amplab/subscriptions","organizations_url":"https://api.github.com/users/amplab/orgs","repos_url":"https://api.github.com/users/amplab/repos","events_url":"https://api.github.com/users/amplab/events{/privacy}","received_events_url":"https://api.github.com/users/amplab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amplab/tachyon","description":" A Reliable Memory Centric Distributed Storage System","fork":false,"url":"https://api.github.com/repos/amplab/tachyon","forks_url":"https://api.github.com/repos/amplab/tachyon/forks","keys_url":"https://api.github.com/repos/amplab/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amplab/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amplab/tachyon/teams","hooks_url":"https://api.github.com/repos/amplab/tachyon/hooks","issue_events_url":"https://api.github.com/repos/amplab/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/amplab/tachyon/events","assignees_url":"https://api.github.com/repos/amplab/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/amplab/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/amplab/tachyon/tags","blobs_url":"https://api.github.com/repos/amplab/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amplab/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amplab/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/amplab/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amplab/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/amplab/tachyon/languages","stargazers_url":"https://api.github.com/repos/amplab/tachyon/stargazers","contributors_url":"https://api.github.com/repos/amplab/tachyon/contributors","subscribers_url":"https://api.github.com/repos/amplab/tachyon/subscribers","subscription_url":"https://api.github.com/repos/amplab/tachyon/subscription","commits_url":"https://api.github.com/repos/amplab/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/amplab/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/amplab/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/amplab/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/amplab/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/amplab/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amplab/tachyon/merges","archive_url":"https://api.github.com/repos/amplab/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amplab/tachyon/downloads","issues_url":"https://api.github.com/repos/amplab/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/amplab/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/amplab/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/amplab/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amplab/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/amplab/tachyon/releases{/id}","created_at":"2012-12-21T17:43:46Z","updated_at":"2015-08-10T23:20:09Z","pushed_at":"2015-08-12T06:54:57Z","git_url":"git://github.com/amplab/tachyon.git","ssh_url":"git@github.com:amplab/tachyon.git","clone_url":"https://github.com/amplab/tachyon.git","svn_url":"https://github.com/amplab/tachyon","homepage":"http://tachyon-project.org","size":39313,"stargazers_count":1498,"watchers_count":1498,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":576,"mirror_url":null,"open_issues_count":27,"forks":576,"open_issues":27,"watchers":1498,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1241"},"html":{"href":"https://github.com/amplab/tachyon/pull/1241"},"issue":{"href":"https://api.github.com/repos/amplab/tachyon/issues/1241"},"comments":{"href":"https://api.github.com/repos/amplab/tachyon/issues/1241/comments"},"review_comments":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1241/comments"},"review_comment":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1241/commits"},"statuses":{"href":"https://api.github.com/repos/amplab/tachyon/statuses/617a802c89a4e0ac2e9bd887ee33c4afea2010f5"}}}}