{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/41719366","id":41719366,"diff_hunk":"@@ -0,0 +1,383 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a 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\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.apache.kafka.common.security.kerberos;\n+\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.regex.Matcher;\n+import java.util.regex.Pattern;\n+\n+import org.apache.kafka.common.security.JaasUtils;\n+\n+\n+/**\n+ * This class implements parsing and handling of Kerberos principal names. In\n+ * particular, it splits them apart and translates them down into local\n+ * operating system names.\n+ */\n+\n+public class KerberosName {\n+    /** The first component of the name */\n+    private final String serviceName;\n+    /** The second component of the name. It may be null. */\n+    private final String hostName;\n+    /** The realm of the name. */\n+    private final String realm;\n+\n+    /**\n+     * A pattern that matches a Kerberos name with at most 2 components.","path":"clients/src/main/java/org/apache/kafka/common/security/kerberos/KerberosName.java","position":45,"original_position":45,"commit_id":"58064b46a7ddbb7d2293e33c7b66c35f76043588","original_commit_id":"58064b46a7ddbb7d2293e33c7b66c35f76043588","user":{"login":"junrao","id":132330,"avatar_url":"https://avatars.githubusercontent.com/u/132330?v=3","gravatar_id":"","url":"https://api.github.com/users/junrao","html_url":"https://github.com/junrao","followers_url":"https://api.github.com/users/junrao/followers","following_url":"https://api.github.com/users/junrao/following{/other_user}","gists_url":"https://api.github.com/users/junrao/gists{/gist_id}","starred_url":"https://api.github.com/users/junrao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junrao/subscriptions","organizations_url":"https://api.github.com/users/junrao/orgs","repos_url":"https://api.github.com/users/junrao/repos","events_url":"https://api.github.com/users/junrao/events{/privacy}","received_events_url":"https://api.github.com/users/junrao/received_events","type":"User","site_admin":false},"body":"2 components -> 3 components ?","created_at":"2015-10-12T02:00:42Z","updated_at":"2015-10-12T02:00:42Z","html_url":"https://github.com/apache/kafka/pull/191#discussion_r41719366","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/191","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/41719366"},"html":{"href":"https://github.com/apache/kafka/pull/191#discussion_r41719366"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/191"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/191","id":44067965,"html_url":"https://github.com/apache/kafka/pull/191","diff_url":"https://github.com/apache/kafka/pull/191.diff","patch_url":"https://github.com/apache/kafka/pull/191.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/191","number":191,"state":"open","locked":false,"title":"KAFKA-1686: Implement SASL/Kerberos.","user":{"login":"harshach","id":38649,"avatar_url":"https://avatars.githubusercontent.com/u/38649?v=3","gravatar_id":"","url":"https://api.github.com/users/harshach","html_url":"https://github.com/harshach","followers_url":"https://api.github.com/users/harshach/followers","following_url":"https://api.github.com/users/harshach/following{/other_user}","gists_url":"https://api.github.com/users/harshach/gists{/gist_id}","starred_url":"https://api.github.com/users/harshach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshach/subscriptions","organizations_url":"https://api.github.com/users/harshach/orgs","repos_url":"https://api.github.com/users/harshach/repos","events_url":"https://api.github.com/users/harshach/events{/privacy}","received_events_url":"https://api.github.com/users/harshach/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-03T04:13:18Z","updated_at":"2015-10-12T02:00:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c4ad478804757b318fa4c0858becfb2eebe5aaf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/191/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/191/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/191/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/58064b46a7ddbb7d2293e33c7b66c35f76043588","head":{"label":"harshach:KAFKA-1686-V1","ref":"KAFKA-1686-V1","sha":"58064b46a7ddbb7d2293e33c7b66c35f76043588","user":{"login":"harshach","id":38649,"avatar_url":"https://avatars.githubusercontent.com/u/38649?v=3","gravatar_id":"","url":"https://api.github.com/users/harshach","html_url":"https://github.com/harshach","followers_url":"https://api.github.com/users/harshach/followers","following_url":"https://api.github.com/users/harshach/following{/other_user}","gists_url":"https://api.github.com/users/harshach/gists{/gist_id}","starred_url":"https://api.github.com/users/harshach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshach/subscriptions","organizations_url":"https://api.github.com/users/harshach/orgs","repos_url":"https://api.github.com/users/harshach/repos","events_url":"https://api.github.com/users/harshach/events{/privacy}","received_events_url":"https://api.github.com/users/harshach/received_events","type":"User","site_admin":false},"repo":{"id":18655234,"name":"kafka","full_name":"harshach/kafka","owner":{"login":"harshach","id":38649,"avatar_url":"https://avatars.githubusercontent.com/u/38649?v=3","gravatar_id":"","url":"https://api.github.com/users/harshach","html_url":"https://github.com/harshach","followers_url":"https://api.github.com/users/harshach/followers","following_url":"https://api.github.com/users/harshach/following{/other_user}","gists_url":"https://api.github.com/users/harshach/gists{/gist_id}","starred_url":"https://api.github.com/users/harshach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshach/subscriptions","organizations_url":"https://api.github.com/users/harshach/orgs","repos_url":"https://api.github.com/users/harshach/repos","events_url":"https://api.github.com/users/harshach/events{/privacy}","received_events_url":"https://api.github.com/users/harshach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/harshach/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/harshach/kafka","forks_url":"https://api.github.com/repos/harshach/kafka/forks","keys_url":"https://api.github.com/repos/harshach/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harshach/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harshach/kafka/teams","hooks_url":"https://api.github.com/repos/harshach/kafka/hooks","issue_events_url":"https://api.github.com/repos/harshach/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/harshach/kafka/events","assignees_url":"https://api.github.com/repos/harshach/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/harshach/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/harshach/kafka/tags","blobs_url":"https://api.github.com/repos/harshach/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harshach/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harshach/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/harshach/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harshach/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/harshach/kafka/languages","stargazers_url":"https://api.github.com/repos/harshach/kafka/stargazers","contributors_url":"https://api.github.com/repos/harshach/kafka/contributors","subscribers_url":"https://api.github.com/repos/harshach/kafka/subscribers","subscription_url":"https://api.github.com/repos/harshach/kafka/subscription","commits_url":"https://api.github.com/repos/harshach/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/harshach/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/harshach/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/harshach/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/harshach/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/harshach/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harshach/kafka/merges","archive_url":"https://api.github.com/repos/harshach/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harshach/kafka/downloads","issues_url":"https://api.github.com/repos/harshach/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/harshach/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/harshach/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/harshach/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harshach/kafka/labels{/name}","releases_url":"https://api.github.com/repos/harshach/kafka/releases{/id}","created_at":"2014-04-10T23:14:58Z","updated_at":"2014-05-27T19:24:36Z","pushed_at":"2015-10-09T22:33:26Z","git_url":"git://github.com/harshach/kafka.git","ssh_url":"git@github.com:harshach/kafka.git","clone_url":"https://github.com/harshach/kafka.git","svn_url":"https://github.com/harshach/kafka","homepage":null,"size":22843,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"0.8.1"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"6a06e22ef81aae3335ca59c94cb0fc33e9f4ceff","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","created_at":"2011-08-15T18:06:16Z","updated_at":"2015-10-11T15:32:06Z","pushed_at":"2015-10-11T19:42:53Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":33672,"stargazers_count":2035,"watchers_count":2035,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1214,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":93,"forks":1214,"open_issues":93,"watchers":2035,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/191"},"html":{"href":"https://github.com/apache/kafka/pull/191"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/191"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/191/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/191/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/58064b46a7ddbb7d2293e33c7b66c35f76043588"}}}}