{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/41833303","id":41833303,"diff_hunk":"@@ -0,0 +1,84 @@\n+package keystonepassword\n+\n+import (\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"net/http\"\n+\t\"runtime/debug\"\n+\n+\t\"github.com/golang/glog\"\n+\t\"github.com/rackspace/gophercloud\"\n+\t\"github.com/rackspace/gophercloud/openstack\"\n+\t\"github.com/rackspace/gophercloud/openstack/identity/v3/tokens\"\n+\n+\tauthapi \"github.com/openshift/origin/pkg/auth/api\"\n+\t\"github.com/openshift/origin/pkg/auth/authenticator\"\n+\t\"k8s.io/kubernetes/pkg/auth/user\"\n+\t\"k8s.io/kubernetes/pkg/util\"\n+)\n+\n+// keystonePasswordAuthenticator uses OpenStack keystone to authenticate a user by password\n+type keystonePasswordAuthenticator struct {\n+\tproviderName   string\n+\turl            string\n+\tclient         *http.Client\n+\tdomainName     string\n+\tidentityMapper authapi.UserIdentityMapper\n+}\n+\n+// New creates a new password authenticator that uses OpenStack keystone to authenticate a user by password\n+// A custom transport can be provided (typically to customize TLS options like trusted roots or present a client certificate).\n+// If no transport is provided, http.DefaultTransport is used\n+func New(providerName string, url string, transport http.RoundTripper, domainName string, identityMapper authapi.UserIdentityMapper) authenticator.Password {\n+\tif transport == nil {\n+\t\ttransport = http.DefaultTransport\n+\t}\n+\tclient := &http.Client{Transport: transport}\n+\treturn &keystonePasswordAuthenticator{providerName, url, client, domainName, identityMapper}\n+}\n+\n+// AuthenticatePassword approves any login attempt which is successfully validated with Keystone\n+func (a keystonePasswordAuthenticator) AuthenticatePassword(username, password string) (user.Info, bool, error) {\n+\tdefer func() {\n+\t\tif e := recover(); e != nil {\n+\t\t\tutil.HandleError(fmt.Errorf(\"Recovered panic: %v, %s\", e, debug.Stack()))\n+\t\t}\n+\t}()\n+\n+\topts := gophercloud.AuthOptions{\n+\t\tIdentityEndpoint: a.url,\n+\t\tUsername:         username,\n+\t\tPassword:         password,\n+\t\tDomainName:       a.domainName,\n+\t}\n+\n+\t// Calling NewClient/Authenticate manually rather than simply calling AuthenticatedClient\n+\t// in order to pass in a transport object that supports SSL\n+\tclient, err := openstack.NewClient(opts.IdentityEndpoint)\n+\tclient.HTTPClient = *a.client\n+\tif err == nil {\n+\t\terr = openstack.AuthenticateV3(client, opts)\n+\t}\n+\n+\tif err != nil {\n+\t\tglog.Infof(\"Failed: Starting openstack authenticate client: %v\", err)","path":"pkg/auth/authenticator/password/keystonepassword/keystonepassword.go","position":64,"original_position":64,"commit_id":"01c86b21e5d3dd38be84f6f8ca233a3c49e2960a","original_commit_id":"01c86b21e5d3dd38be84f6f8ca233a3c49e2960a","user":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"body":"higher verbosity, probably V(4)","created_at":"2015-10-13T07:14:16Z","updated_at":"2015-10-13T07:14:16Z","html_url":"https://github.com/openshift/origin/pull/4951#discussion_r41833303","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/4951","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/41833303"},"html":{"href":"https://github.com/openshift/origin/pull/4951#discussion_r41833303"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/4951"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/4951","id":46792859,"html_url":"https://github.com/openshift/origin/pull/4951","diff_url":"https://github.com/openshift/origin/pull/4951.diff","patch_url":"https://github.com/openshift/origin/pull/4951.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/4951","number":4951,"state":"open","locked":false,"title":"WIP adding keystone IdP","user":{"login":"sseago","id":1120000,"avatar_url":"https://avatars.githubusercontent.com/u/1120000?v=3","gravatar_id":"","url":"https://api.github.com/users/sseago","html_url":"https://github.com/sseago","followers_url":"https://api.github.com/users/sseago/followers","following_url":"https://api.github.com/users/sseago/following{/other_user}","gists_url":"https://api.github.com/users/sseago/gists{/gist_id}","starred_url":"https://api.github.com/users/sseago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sseago/subscriptions","organizations_url":"https://api.github.com/users/sseago/orgs","repos_url":"https://api.github.com/users/sseago/repos","events_url":"https://api.github.com/users/sseago/events{/privacy}","received_events_url":"https://api.github.com/users/sseago/received_events","type":"User","site_admin":false},"body":"Do not merge.\r\n\r\nThis now works with Keystone v3 both with and without SSL. Unit tests are still absent.","created_at":"2015-10-05T15:09:51Z","updated_at":"2015-10-13T07:14:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7e6aa6a7ca40b51a22ba9fd60c794d7bb565a9f","assignee":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/4951/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/4951/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/4951/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/01c86b21e5d3dd38be84f6f8ca233a3c49e2960a","head":{"label":"sseago:keystone-idp","ref":"keystone-idp","sha":"01c86b21e5d3dd38be84f6f8ca233a3c49e2960a","user":{"login":"sseago","id":1120000,"avatar_url":"https://avatars.githubusercontent.com/u/1120000?v=3","gravatar_id":"","url":"https://api.github.com/users/sseago","html_url":"https://github.com/sseago","followers_url":"https://api.github.com/users/sseago/followers","following_url":"https://api.github.com/users/sseago/following{/other_user}","gists_url":"https://api.github.com/users/sseago/gists{/gist_id}","starred_url":"https://api.github.com/users/sseago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sseago/subscriptions","organizations_url":"https://api.github.com/users/sseago/orgs","repos_url":"https://api.github.com/users/sseago/repos","events_url":"https://api.github.com/users/sseago/events{/privacy}","received_events_url":"https://api.github.com/users/sseago/received_events","type":"User","site_admin":false},"repo":{"id":37005678,"name":"origin","full_name":"sseago/origin","owner":{"login":"sseago","id":1120000,"avatar_url":"https://avatars.githubusercontent.com/u/1120000?v=3","gravatar_id":"","url":"https://api.github.com/users/sseago","html_url":"https://github.com/sseago","followers_url":"https://api.github.com/users/sseago/followers","following_url":"https://api.github.com/users/sseago/following{/other_user}","gists_url":"https://api.github.com/users/sseago/gists{/gist_id}","starred_url":"https://api.github.com/users/sseago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sseago/subscriptions","organizations_url":"https://api.github.com/users/sseago/orgs","repos_url":"https://api.github.com/users/sseago/repos","events_url":"https://api.github.com/users/sseago/events{/privacy}","received_events_url":"https://api.github.com/users/sseago/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sseago/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/sseago/origin","forks_url":"https://api.github.com/repos/sseago/origin/forks","keys_url":"https://api.github.com/repos/sseago/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sseago/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sseago/origin/teams","hooks_url":"https://api.github.com/repos/sseago/origin/hooks","issue_events_url":"https://api.github.com/repos/sseago/origin/issues/events{/number}","events_url":"https://api.github.com/repos/sseago/origin/events","assignees_url":"https://api.github.com/repos/sseago/origin/assignees{/user}","branches_url":"https://api.github.com/repos/sseago/origin/branches{/branch}","tags_url":"https://api.github.com/repos/sseago/origin/tags","blobs_url":"https://api.github.com/repos/sseago/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sseago/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sseago/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/sseago/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sseago/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/sseago/origin/languages","stargazers_url":"https://api.github.com/repos/sseago/origin/stargazers","contributors_url":"https://api.github.com/repos/sseago/origin/contributors","subscribers_url":"https://api.github.com/repos/sseago/origin/subscribers","subscription_url":"https://api.github.com/repos/sseago/origin/subscription","commits_url":"https://api.github.com/repos/sseago/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/sseago/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/sseago/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/sseago/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/sseago/origin/contents/{+path}","compare_url":"https://api.github.com/repos/sseago/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sseago/origin/merges","archive_url":"https://api.github.com/repos/sseago/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sseago/origin/downloads","issues_url":"https://api.github.com/repos/sseago/origin/issues{/number}","pulls_url":"https://api.github.com/repos/sseago/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/sseago/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/sseago/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sseago/origin/labels{/name}","releases_url":"https://api.github.com/repos/sseago/origin/releases{/id}","created_at":"2015-06-07T05:24:17Z","updated_at":"2015-06-07T05:24:23Z","pushed_at":"2015-10-13T04:40:32Z","git_url":"git://github.com/sseago/origin.git","ssh_url":"git@github.com:sseago/origin.git","clone_url":"https://github.com/sseago/origin.git","svn_url":"https://github.com/sseago/origin","homepage":"http://www.openshift.org","size":144728,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"9a8606e4d29760dbba2fba768f3d16699136de36","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-10-13T06:44:51Z","pushed_at":"2015-10-13T07:12:10Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":258726,"stargazers_count":735,"watchers_count":735,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":446,"mirror_url":null,"open_issues_count":591,"forks":446,"open_issues":591,"watchers":735,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/4951"},"html":{"href":"https://github.com/openshift/origin/pull/4951"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/4951"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/4951/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/4951/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/4951/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/01c86b21e5d3dd38be84f6f8ca233a3c49e2960a"}}}}