{"action":"created","comment":{"url":"https://api.github.com/repos/lyft/confidant/pulls/comments/57257199","id":57257199,"diff_hunk":"@@ -96,8 +74,8 @@ def check_csrf_token():\n     # csrf tokens.\n     if g.auth_type == 'kms':\n         return True\n-    token = request.headers.get('X-XSRF-TOKEN')\n-    return safe_str_cmp(token, session.get('XSRF-TOKEN'))\n+    token = request.headers.get('X-XSRF-TOKEN', '')","path":"confidant/authnz/__init__.py","position":74,"original_position":74,"commit_id":"87b74ee59c1c1ab50d33b06c3c19e8b646636320","original_commit_id":"87b74ee59c1c1ab50d33b06c3c19e8b646636320","user":{"login":"ryan-lane","id":1538354,"avatar_url":"https://avatars.githubusercontent.com/u/1538354?v=3","gravatar_id":"","url":"https://api.github.com/users/ryan-lane","html_url":"https://github.com/ryan-lane","followers_url":"https://api.github.com/users/ryan-lane/followers","following_url":"https://api.github.com/users/ryan-lane/following{/other_user}","gists_url":"https://api.github.com/users/ryan-lane/gists{/gist_id}","starred_url":"https://api.github.com/users/ryan-lane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryan-lane/subscriptions","organizations_url":"https://api.github.com/users/ryan-lane/orgs","repos_url":"https://api.github.com/users/ryan-lane/repos","events_url":"https://api.github.com/users/ryan-lane/events{/privacy}","received_events_url":"https://api.github.com/users/ryan-lane/received_events","type":"User","site_admin":false},"body":"I wonder if we should check to see if token is None and return False here if so.","created_at":"2016-03-23T23:58:20Z","updated_at":"2016-03-23T23:58:20Z","html_url":"https://github.com/lyft/confidant/pull/52#discussion_r57257199","pull_request_url":"https://api.github.com/repos/lyft/confidant/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/lyft/confidant/pulls/comments/57257199"},"html":{"href":"https://github.com/lyft/confidant/pull/52#discussion_r57257199"},"pull_request":{"href":"https://api.github.com/repos/lyft/confidant/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/lyft/confidant/pulls/52","id":63930251,"html_url":"https://github.com/lyft/confidant/pull/52","diff_url":"https://github.com/lyft/confidant/pull/52.diff","patch_url":"https://github.com/lyft/confidant/pull/52.patch","issue_url":"https://api.github.com/repos/lyft/confidant/issues/52","number":52,"state":"open","locked":false,"title":"Modular user AuthN, support for SAML","user":{"login":"ab","id":350770,"avatar_url":"https://avatars.githubusercontent.com/u/350770?v=3","gravatar_id":"","url":"https://api.github.com/users/ab","html_url":"https://github.com/ab","followers_url":"https://api.github.com/users/ab/followers","following_url":"https://api.github.com/users/ab/following{/other_user}","gists_url":"https://api.github.com/users/ab/gists{/gist_id}","starred_url":"https://api.github.com/users/ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ab/subscriptions","organizations_url":"https://api.github.com/users/ab/orgs","repos_url":"https://api.github.com/users/ab/repos","events_url":"https://api.github.com/users/ab/events{/privacy}","received_events_url":"https://api.github.com/users/ab/received_events","type":"User","site_admin":false},"body":"@ryan-lane This is definitely a work in progress, opening a PR to get feedback on the approach here before I do too much more. I used the 1.1 branch as the base since there was a bunch of refactoring; I hope that was a good thing to do.\r\n\r\nSummary of changes:\r\n\r\n- Add a dependency on python-saml for SAML support.\r\n- Add an ABC AbstractUserAuthenticator that different user authentication modules can inherit from. These classes must implement `log_in()` and `auth_type()`, and may implement `log_out()` or other custom functionality.\r\n- The auth module in use is configured by `USER_AUTH_MODULE` in settings.\r\n- Convert the existing authentication modules into `NullUserAuthenticator` (for `USE_AUTH=false`) and `GoogleOauthAuthenticator`, which is mostly copy pasted from the existing code.\r\n- Add a new authentication module `SamlAuthenticator`, which implements support for SAML. This also requires some custom routes for the callback handlers, which are all namespaced under `/v1/saml/`.\r\n- Add rudimentary support for `/logout`, which either performs a SAML SingleLogOut flow or just clears the session. The `goodbye.html` is just a stub that I blindly cargo culted from `index.html`.\r\n\r\nTesting:\r\n- I haven't written any automated tests yet, and I'm sure this breaks the existing tests, but I haven't yet been able to run them.\r\n- I've manually tested all three auth modules (Null, Google OAuth, and SAML), and they all seem to work!\r\n- I'm hoping to have time to write documentation howtos on getting each of OAuth and SAML integrated with Google as the identity provider. They're both finicky, but pretty straightforward if you know how to do it.","created_at":"2016-03-23T18:26:15Z","updated_at":"2016-03-23T23:58:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff6e9b5e58cbce591c0b2f330ffc828670876425","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lyft/confidant/pulls/52/commits","review_comments_url":"https://api.github.com/repos/lyft/confidant/pulls/52/comments","review_comment_url":"https://api.github.com/repos/lyft/confidant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lyft/confidant/issues/52/comments","statuses_url":"https://api.github.com/repos/lyft/confidant/statuses/87b74ee59c1c1ab50d33b06c3c19e8b646636320","head":{"label":"ab:saml","ref":"saml","sha":"87b74ee59c1c1ab50d33b06c3c19e8b646636320","user":{"login":"ab","id":350770,"avatar_url":"https://avatars.githubusercontent.com/u/350770?v=3","gravatar_id":"","url":"https://api.github.com/users/ab","html_url":"https://github.com/ab","followers_url":"https://api.github.com/users/ab/followers","following_url":"https://api.github.com/users/ab/following{/other_user}","gists_url":"https://api.github.com/users/ab/gists{/gist_id}","starred_url":"https://api.github.com/users/ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ab/subscriptions","organizations_url":"https://api.github.com/users/ab/orgs","repos_url":"https://api.github.com/users/ab/repos","events_url":"https://api.github.com/users/ab/events{/privacy}","received_events_url":"https://api.github.com/users/ab/received_events","type":"User","site_admin":false},"repo":{"id":52411590,"name":"confidant","full_name":"ab/confidant","owner":{"login":"ab","id":350770,"avatar_url":"https://avatars.githubusercontent.com/u/350770?v=3","gravatar_id":"","url":"https://api.github.com/users/ab","html_url":"https://github.com/ab","followers_url":"https://api.github.com/users/ab/followers","following_url":"https://api.github.com/users/ab/following{/other_user}","gists_url":"https://api.github.com/users/ab/gists{/gist_id}","starred_url":"https://api.github.com/users/ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ab/subscriptions","organizations_url":"https://api.github.com/users/ab/orgs","repos_url":"https://api.github.com/users/ab/repos","events_url":"https://api.github.com/users/ab/events{/privacy}","received_events_url":"https://api.github.com/users/ab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ab/confidant","description":"Confidant: your secret keeper.","fork":true,"url":"https://api.github.com/repos/ab/confidant","forks_url":"https://api.github.com/repos/ab/confidant/forks","keys_url":"https://api.github.com/repos/ab/confidant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ab/confidant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ab/confidant/teams","hooks_url":"https://api.github.com/repos/ab/confidant/hooks","issue_events_url":"https://api.github.com/repos/ab/confidant/issues/events{/number}","events_url":"https://api.github.com/repos/ab/confidant/events","assignees_url":"https://api.github.com/repos/ab/confidant/assignees{/user}","branches_url":"https://api.github.com/repos/ab/confidant/branches{/branch}","tags_url":"https://api.github.com/repos/ab/confidant/tags","blobs_url":"https://api.github.com/repos/ab/confidant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ab/confidant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ab/confidant/git/refs{/sha}","trees_url":"https://api.github.com/repos/ab/confidant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ab/confidant/statuses/{sha}","languages_url":"https://api.github.com/repos/ab/confidant/languages","stargazers_url":"https://api.github.com/repos/ab/confidant/stargazers","contributors_url":"https://api.github.com/repos/ab/confidant/contributors","subscribers_url":"https://api.github.com/repos/ab/confidant/subscribers","subscription_url":"https://api.github.com/repos/ab/confidant/subscription","commits_url":"https://api.github.com/repos/ab/confidant/commits{/sha}","git_commits_url":"https://api.github.com/repos/ab/confidant/git/commits{/sha}","comments_url":"https://api.github.com/repos/ab/confidant/comments{/number}","issue_comment_url":"https://api.github.com/repos/ab/confidant/issues/comments{/number}","contents_url":"https://api.github.com/repos/ab/confidant/contents/{+path}","compare_url":"https://api.github.com/repos/ab/confidant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ab/confidant/merges","archive_url":"https://api.github.com/repos/ab/confidant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ab/confidant/downloads","issues_url":"https://api.github.com/repos/ab/confidant/issues{/number}","pulls_url":"https://api.github.com/repos/ab/confidant/pulls{/number}","milestones_url":"https://api.github.com/repos/ab/confidant/milestones{/number}","notifications_url":"https://api.github.com/repos/ab/confidant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ab/confidant/labels{/name}","releases_url":"https://api.github.com/repos/ab/confidant/releases{/id}","deployments_url":"https://api.github.com/repos/ab/confidant/deployments","created_at":"2016-02-24T03:32:35Z","updated_at":"2016-02-24T03:32:36Z","pushed_at":"2016-03-23T21:59:31Z","git_url":"git://github.com/ab/confidant.git","ssh_url":"git@github.com:ab/confidant.git","clone_url":"https://github.com/ab/confidant.git","svn_url":"https://github.com/ab/confidant","homepage":"https://lyft.github.io/confidant","size":749,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"lyft:1.1","ref":"1.1","sha":"019f8340841e66fedc8c7b477c55cf55436e6d30","user":{"login":"lyft","id":4269340,"avatar_url":"https://avatars.githubusercontent.com/u/4269340?v=3","gravatar_id":"","url":"https://api.github.com/users/lyft","html_url":"https://github.com/lyft","followers_url":"https://api.github.com/users/lyft/followers","following_url":"https://api.github.com/users/lyft/following{/other_user}","gists_url":"https://api.github.com/users/lyft/gists{/gist_id}","starred_url":"https://api.github.com/users/lyft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyft/subscriptions","organizations_url":"https://api.github.com/users/lyft/orgs","repos_url":"https://api.github.com/users/lyft/repos","events_url":"https://api.github.com/users/lyft/events{/privacy}","received_events_url":"https://api.github.com/users/lyft/received_events","type":"Organization","site_admin":false},"repo":{"id":42324225,"name":"confidant","full_name":"lyft/confidant","owner":{"login":"lyft","id":4269340,"avatar_url":"https://avatars.githubusercontent.com/u/4269340?v=3","gravatar_id":"","url":"https://api.github.com/users/lyft","html_url":"https://github.com/lyft","followers_url":"https://api.github.com/users/lyft/followers","following_url":"https://api.github.com/users/lyft/following{/other_user}","gists_url":"https://api.github.com/users/lyft/gists{/gist_id}","starred_url":"https://api.github.com/users/lyft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyft/subscriptions","organizations_url":"https://api.github.com/users/lyft/orgs","repos_url":"https://api.github.com/users/lyft/repos","events_url":"https://api.github.com/users/lyft/events{/privacy}","received_events_url":"https://api.github.com/users/lyft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lyft/confidant","description":"Confidant: your secret keeper.","fork":false,"url":"https://api.github.com/repos/lyft/confidant","forks_url":"https://api.github.com/repos/lyft/confidant/forks","keys_url":"https://api.github.com/repos/lyft/confidant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lyft/confidant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lyft/confidant/teams","hooks_url":"https://api.github.com/repos/lyft/confidant/hooks","issue_events_url":"https://api.github.com/repos/lyft/confidant/issues/events{/number}","events_url":"https://api.github.com/repos/lyft/confidant/events","assignees_url":"https://api.github.com/repos/lyft/confidant/assignees{/user}","branches_url":"https://api.github.com/repos/lyft/confidant/branches{/branch}","tags_url":"https://api.github.com/repos/lyft/confidant/tags","blobs_url":"https://api.github.com/repos/lyft/confidant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lyft/confidant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lyft/confidant/git/refs{/sha}","trees_url":"https://api.github.com/repos/lyft/confidant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lyft/confidant/statuses/{sha}","languages_url":"https://api.github.com/repos/lyft/confidant/languages","stargazers_url":"https://api.github.com/repos/lyft/confidant/stargazers","contributors_url":"https://api.github.com/repos/lyft/confidant/contributors","subscribers_url":"https://api.github.com/repos/lyft/confidant/subscribers","subscription_url":"https://api.github.com/repos/lyft/confidant/subscription","commits_url":"https://api.github.com/repos/lyft/confidant/commits{/sha}","git_commits_url":"https://api.github.com/repos/lyft/confidant/git/commits{/sha}","comments_url":"https://api.github.com/repos/lyft/confidant/comments{/number}","issue_comment_url":"https://api.github.com/repos/lyft/confidant/issues/comments{/number}","contents_url":"https://api.github.com/repos/lyft/confidant/contents/{+path}","compare_url":"https://api.github.com/repos/lyft/confidant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lyft/confidant/merges","archive_url":"https://api.github.com/repos/lyft/confidant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lyft/confidant/downloads","issues_url":"https://api.github.com/repos/lyft/confidant/issues{/number}","pulls_url":"https://api.github.com/repos/lyft/confidant/pulls{/number}","milestones_url":"https://api.github.com/repos/lyft/confidant/milestones{/number}","notifications_url":"https://api.github.com/repos/lyft/confidant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lyft/confidant/labels{/name}","releases_url":"https://api.github.com/repos/lyft/confidant/releases{/id}","deployments_url":"https://api.github.com/repos/lyft/confidant/deployments","created_at":"2015-09-11T18:02:12Z","updated_at":"2016-03-23T23:35:46Z","pushed_at":"2016-03-23T21:59:32Z","git_url":"git://github.com/lyft/confidant.git","ssh_url":"git@github.com:lyft/confidant.git","clone_url":"https://github.com/lyft/confidant.git","svn_url":"https://github.com/lyft/confidant","homepage":"https://lyft.github.io/confidant","size":726,"stargazers_count":860,"watchers_count":860,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":30,"mirror_url":null,"open_issues_count":29,"forks":30,"open_issues":29,"watchers":860,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lyft/confidant/pulls/52"},"html":{"href":"https://github.com/lyft/confidant/pull/52"},"issue":{"href":"https://api.github.com/repos/lyft/confidant/issues/52"},"comments":{"href":"https://api.github.com/repos/lyft/confidant/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/lyft/confidant/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/lyft/confidant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lyft/confidant/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/lyft/confidant/statuses/87b74ee59c1c1ab50d33b06c3c19e8b646636320"}}}}