{"action":"created","comment":{"url":"https://api.github.com/repos/argoproj/argo-cd/pulls/comments/182296962","pull_request_review_id":113063999,"id":182296962,"diff_hunk":"@@ -26,10 +30,17 @@ message SessionResponse {\n service SessionService {\n \n   // Create a new JWT for authentication.\n-  rpc Create(SessionRequest) returns (SessionResponse) {\n+  rpc Create(SessionCreateRequest) returns (SessionResponse) {\n     option (google.api.http) = {\n-      post: \"/api/v1/sessions/create\"\n+      post: \"/api/v1/session/create\"","path":"server/session/session.proto","position":27,"original_position":27,"commit_id":"d8741d4f673c24bbf4d527b9820f8ce63c4fcf86","original_commit_id":"2947f39d97e26f7a5da39e12d1c48d015ad5cf71","user":{"login":"merenbach","id":1137108,"avatar_url":"https://avatars0.githubusercontent.com/u/1137108?v=4","gravatar_id":"","url":"https://api.github.com/users/merenbach","html_url":"https://github.com/merenbach","followers_url":"https://api.github.com/users/merenbach/followers","following_url":"https://api.github.com/users/merenbach/following{/other_user}","gists_url":"https://api.github.com/users/merenbach/gists{/gist_id}","starred_url":"https://api.github.com/users/merenbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merenbach/subscriptions","organizations_url":"https://api.github.com/users/merenbach/orgs","repos_url":"https://api.github.com/users/merenbach/repos","events_url":"https://api.github.com/users/merenbach/events{/privacy}","received_events_url":"https://api.github.com/users/merenbach/received_events","type":"User","site_admin":false},"body":"@jessesuen I'm not sure what's being suggested.  Currently I'm under the impression that the `Create` method, regardless of name, serves two functions:\r\n\r\n1. Create a cookie for the Web client.\r\n2. Create a token and return it (for use by the CLI).\r\n\r\nThe `Delete` method, meanwhile, simply sets the cookie again, but to a blank value, and doesn't do any username/password checking.\r\n\r\nIf we combine `Create` and `Delete` into a single Go method, switching on HTTP method, there isn't a unified SessionRequest type since username and password are required for login but useless for logout.  Unless I'm mistaken, we also won't have an HTTP method on which to switch when logging in with the CLI.\r\n\r\nI suspect there's some feature of gRPC that I'm not understanding fully, hence the above confusion.","created_at":"2018-04-18T03:00:49Z","updated_at":"2018-04-18T03:00:50Z","html_url":"https://github.com/argoproj/argo-cd/pull/96#discussion_r182296962","pull_request_url":"https://api.github.com/repos/argoproj/argo-cd/pulls/96","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/argoproj/argo-cd/pulls/comments/182296962"},"html":{"href":"https://github.com/argoproj/argo-cd/pull/96#discussion_r182296962"},"pull_request":{"href":"https://api.github.com/repos/argoproj/argo-cd/pulls/96"}},"in_reply_to_id":182288878},"pull_request":{"url":"https://api.github.com/repos/argoproj/argo-cd/pulls/96","id":182346798,"html_url":"https://github.com/argoproj/argo-cd/pull/96","diff_url":"https://github.com/argoproj/argo-cd/pull/96.diff","patch_url":"https://github.com/argoproj/argo-cd/pull/96.patch","issue_url":"https://api.github.com/repos/argoproj/argo-cd/issues/96","number":96,"state":"open","locked":false,"title":"Add server auth cookies","user":{"login":"merenbach","id":1137108,"avatar_url":"https://avatars0.githubusercontent.com/u/1137108?v=4","gravatar_id":"","url":"https://api.github.com/users/merenbach","html_url":"https://github.com/merenbach","followers_url":"https://api.github.com/users/merenbach/followers","following_url":"https://api.github.com/users/merenbach/following{/other_user}","gists_url":"https://api.github.com/users/merenbach/gists{/gist_id}","starred_url":"https://api.github.com/users/merenbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merenbach/subscriptions","organizations_url":"https://api.github.com/users/merenbach/orgs","repos_url":"https://api.github.com/users/merenbach/repos","events_url":"https://api.github.com/users/merenbach/events{/privacy}","received_events_url":"https://api.github.com/users/merenbach/received_events","type":"User","site_admin":false},"body":"This provides server-side cookie support for Argo CD!\r\n\r\n1. Rename login endpoint to `/api/v1/session/create` (from previous plural `sessions`).\r\n\r\n2. The login endpoint not only returns the non-expiring token (for benefit of the CLI), but also sets a cookie on any relevant HTTP response.\r\n\r\n3. Add logout endpoint to `/api/v1/session/delete`.  This has an effect only for Web clients and uses `Max-Age=0` for simplicity.  Logout **will not work with IE 6, 7, or 8**, which is probably best considered a feature.  This is because these browsers do not support `Max-Age` (for more info, see [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)).\r\n\r\n4. Check cookie values with existing token check in `server/server.go`.\r\n\r\n**This PR does not remove our feature flag to disable auth by default.**\r\n\r\n## Examples\r\n\r\nFor creating a token (note that `-XPOST` isn't required when using the `-d` parameter):\r\n\r\n```\r\n$ curl -i localhost:8080/api/v1/session/create -d'{\"username\":\"admin\",\"password\":\"<redacted>\"}'\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json\r\nGrpc-Metadata-Content-Type: application/grpc\r\nGrpc-Metadata-Set-Cookie: com.intuit.argocd.auth.token=<redacted>.<redacted>.<redacted>; Secure; HttpOnly; path=/\r\nDate: Wed, 18 Apr 2018 01:41:46 GMT\r\nContent-Length: 179\r\n\r\n{\"token\":\"<redacted>.<redacted>.<redacted>\"}\r\n```\r\n\r\nFor deleting a token (note the empty token in the response):\r\n\r\n```\r\n$ curl -i -XDELETE localhost:8080/api/v1/session/delete\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json\r\nGrpc-Metadata-Content-Type: application/grpc\r\nGrpc-Metadata-Set-Cookie: com.intuit.argocd.auth.token=; Secure; HttpOnly; path=/; Max-Age=0\r\nDate: Wed, 18 Apr 2018 01:43:14 GMT\r\nContent-Length: 2\r\n\r\n{}\r\n```","created_at":"2018-04-18T01:46:56Z","updated_at":"2018-04-18T03:00:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9f1037bb04b65ada08da45fee0a027d924d3b8c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/argoproj/argo-cd/pulls/96/commits","review_comments_url":"https://api.github.com/repos/argoproj/argo-cd/pulls/96/comments","review_comment_url":"https://api.github.com/repos/argoproj/argo-cd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/argoproj/argo-cd/issues/96/comments","statuses_url":"https://api.github.com/repos/argoproj/argo-cd/statuses/d8741d4f673c24bbf4d527b9820f8ce63c4fcf86","head":{"label":"merenbach:add-server-auth-cookies","ref":"add-server-auth-cookies","sha":"d8741d4f673c24bbf4d527b9820f8ce63c4fcf86","user":{"login":"merenbach","id":1137108,"avatar_url":"https://avatars0.githubusercontent.com/u/1137108?v=4","gravatar_id":"","url":"https://api.github.com/users/merenbach","html_url":"https://github.com/merenbach","followers_url":"https://api.github.com/users/merenbach/followers","following_url":"https://api.github.com/users/merenbach/following{/other_user}","gists_url":"https://api.github.com/users/merenbach/gists{/gist_id}","starred_url":"https://api.github.com/users/merenbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merenbach/subscriptions","organizations_url":"https://api.github.com/users/merenbach/orgs","repos_url":"https://api.github.com/users/merenbach/repos","events_url":"https://api.github.com/users/merenbach/events{/privacy}","received_events_url":"https://api.github.com/users/merenbach/received_events","type":"User","site_admin":false},"repo":{"id":124958401,"name":"argo-cd","full_name":"merenbach/argo-cd","owner":{"login":"merenbach","id":1137108,"avatar_url":"https://avatars0.githubusercontent.com/u/1137108?v=4","gravatar_id":"","url":"https://api.github.com/users/merenbach","html_url":"https://github.com/merenbach","followers_url":"https://api.github.com/users/merenbach/followers","following_url":"https://api.github.com/users/merenbach/following{/other_user}","gists_url":"https://api.github.com/users/merenbach/gists{/gist_id}","starred_url":"https://api.github.com/users/merenbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merenbach/subscriptions","organizations_url":"https://api.github.com/users/merenbach/orgs","repos_url":"https://api.github.com/users/merenbach/repos","events_url":"https://api.github.com/users/merenbach/events{/privacy}","received_events_url":"https://api.github.com/users/merenbach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/merenbach/argo-cd","description":"GitOps Continuous Delivery for Kubernetes","fork":true,"url":"https://api.github.com/repos/merenbach/argo-cd","forks_url":"https://api.github.com/repos/merenbach/argo-cd/forks","keys_url":"https://api.github.com/repos/merenbach/argo-cd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/merenbach/argo-cd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/merenbach/argo-cd/teams","hooks_url":"https://api.github.com/repos/merenbach/argo-cd/hooks","issue_events_url":"https://api.github.com/repos/merenbach/argo-cd/issues/events{/number}","events_url":"https://api.github.com/repos/merenbach/argo-cd/events","assignees_url":"https://api.github.com/repos/merenbach/argo-cd/assignees{/user}","branches_url":"https://api.github.com/repos/merenbach/argo-cd/branches{/branch}","tags_url":"https://api.github.com/repos/merenbach/argo-cd/tags","blobs_url":"https://api.github.com/repos/merenbach/argo-cd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/merenbach/argo-cd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/merenbach/argo-cd/git/refs{/sha}","trees_url":"https://api.github.com/repos/merenbach/argo-cd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/merenbach/argo-cd/statuses/{sha}","languages_url":"https://api.github.com/repos/merenbach/argo-cd/languages","stargazers_url":"https://api.github.com/repos/merenbach/argo-cd/stargazers","contributors_url":"https://api.github.com/repos/merenbach/argo-cd/contributors","subscribers_url":"https://api.github.com/repos/merenbach/argo-cd/subscribers","subscription_url":"https://api.github.com/repos/merenbach/argo-cd/subscription","commits_url":"https://api.github.com/repos/merenbach/argo-cd/commits{/sha}","git_commits_url":"https://api.github.com/repos/merenbach/argo-cd/git/commits{/sha}","comments_url":"https://api.github.com/repos/merenbach/argo-cd/comments{/number}","issue_comment_url":"https://api.github.com/repos/merenbach/argo-cd/issues/comments{/number}","contents_url":"https://api.github.com/repos/merenbach/argo-cd/contents/{+path}","compare_url":"https://api.github.com/repos/merenbach/argo-cd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/merenbach/argo-cd/merges","archive_url":"https://api.github.com/repos/merenbach/argo-cd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/merenbach/argo-cd/downloads","issues_url":"https://api.github.com/repos/merenbach/argo-cd/issues{/number}","pulls_url":"https://api.github.com/repos/merenbach/argo-cd/pulls{/number}","milestones_url":"https://api.github.com/repos/merenbach/argo-cd/milestones{/number}","notifications_url":"https://api.github.com/repos/merenbach/argo-cd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/merenbach/argo-cd/labels{/name}","releases_url":"https://api.github.com/repos/merenbach/argo-cd/releases{/id}","deployments_url":"https://api.github.com/repos/merenbach/argo-cd/deployments","created_at":"2018-03-12T22:17:11Z","updated_at":"2018-03-13T17:01:33Z","pushed_at":"2018-04-18T02:56:24Z","git_url":"git://github.com/merenbach/argo-cd.git","ssh_url":"git@github.com:merenbach/argo-cd.git","clone_url":"https://github.com/merenbach/argo-cd.git","svn_url":"https://github.com/merenbach/argo-cd","homepage":"","size":1352,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"argoproj:master","ref":"master","sha":"db8083c6573ba4a514bbad11d73f5e65e9ed06a6","user":{"login":"argoproj","id":30269780,"avatar_url":"https://avatars3.githubusercontent.com/u/30269780?v=4","gravatar_id":"","url":"https://api.github.com/users/argoproj","html_url":"https://github.com/argoproj","followers_url":"https://api.github.com/users/argoproj/followers","following_url":"https://api.github.com/users/argoproj/following{/other_user}","gists_url":"https://api.github.com/users/argoproj/gists{/gist_id}","starred_url":"https://api.github.com/users/argoproj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/argoproj/subscriptions","organizations_url":"https://api.github.com/users/argoproj/orgs","repos_url":"https://api.github.com/users/argoproj/repos","events_url":"https://api.github.com/users/argoproj/events{/privacy}","received_events_url":"https://api.github.com/users/argoproj/received_events","type":"Organization","site_admin":false},"repo":{"id":120896210,"name":"argo-cd","full_name":"argoproj/argo-cd","owner":{"login":"argoproj","id":30269780,"avatar_url":"https://avatars3.githubusercontent.com/u/30269780?v=4","gravatar_id":"","url":"https://api.github.com/users/argoproj","html_url":"https://github.com/argoproj","followers_url":"https://api.github.com/users/argoproj/followers","following_url":"https://api.github.com/users/argoproj/following{/other_user}","gists_url":"https://api.github.com/users/argoproj/gists{/gist_id}","starred_url":"https://api.github.com/users/argoproj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/argoproj/subscriptions","organizations_url":"https://api.github.com/users/argoproj/orgs","repos_url":"https://api.github.com/users/argoproj/repos","events_url":"https://api.github.com/users/argoproj/events{/privacy}","received_events_url":"https://api.github.com/users/argoproj/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/argoproj/argo-cd","description":"GitOps Continuous Delivery for Kubernetes","fork":false,"url":"https://api.github.com/repos/argoproj/argo-cd","forks_url":"https://api.github.com/repos/argoproj/argo-cd/forks","keys_url":"https://api.github.com/repos/argoproj/argo-cd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/argoproj/argo-cd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/argoproj/argo-cd/teams","hooks_url":"https://api.github.com/repos/argoproj/argo-cd/hooks","issue_events_url":"https://api.github.com/repos/argoproj/argo-cd/issues/events{/number}","events_url":"https://api.github.com/repos/argoproj/argo-cd/events","assignees_url":"https://api.github.com/repos/argoproj/argo-cd/assignees{/user}","branches_url":"https://api.github.com/repos/argoproj/argo-cd/branches{/branch}","tags_url":"https://api.github.com/repos/argoproj/argo-cd/tags","blobs_url":"https://api.github.com/repos/argoproj/argo-cd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/argoproj/argo-cd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/argoproj/argo-cd/git/refs{/sha}","trees_url":"https://api.github.com/repos/argoproj/argo-cd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/argoproj/argo-cd/statuses/{sha}","languages_url":"https://api.github.com/repos/argoproj/argo-cd/languages","stargazers_url":"https://api.github.com/repos/argoproj/argo-cd/stargazers","contributors_url":"https://api.github.com/repos/argoproj/argo-cd/contributors","subscribers_url":"https://api.github.com/repos/argoproj/argo-cd/subscribers","subscription_url":"https://api.github.com/repos/argoproj/argo-cd/subscription","commits_url":"https://api.github.com/repos/argoproj/argo-cd/commits{/sha}","git_commits_url":"https://api.github.com/repos/argoproj/argo-cd/git/commits{/sha}","comments_url":"https://api.github.com/repos/argoproj/argo-cd/comments{/number}","issue_comment_url":"https://api.github.com/repos/argoproj/argo-cd/issues/comments{/number}","contents_url":"https://api.github.com/repos/argoproj/argo-cd/contents/{+path}","compare_url":"https://api.github.com/repos/argoproj/argo-cd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/argoproj/argo-cd/merges","archive_url":"https://api.github.com/repos/argoproj/argo-cd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/argoproj/argo-cd/downloads","issues_url":"https://api.github.com/repos/argoproj/argo-cd/issues{/number}","pulls_url":"https://api.github.com/repos/argoproj/argo-cd/pulls{/number}","milestones_url":"https://api.github.com/repos/argoproj/argo-cd/milestones{/number}","notifications_url":"https://api.github.com/repos/argoproj/argo-cd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/argoproj/argo-cd/labels{/name}","releases_url":"https://api.github.com/repos/argoproj/argo-cd/releases{/id}","deployments_url":"https://api.github.com/repos/argoproj/argo-cd/deployments","created_at":"2018-02-09T11:12:01Z","updated_at":"2018-04-18T00:30:24Z","pushed_at":"2018-04-18T02:56:25Z","git_url":"git://github.com/argoproj/argo-cd.git","ssh_url":"git@github.com:argoproj/argo-cd.git","clone_url":"https://github.com/argoproj/argo-cd.git","svn_url":"https://github.com/argoproj/argo-cd","homepage":"","size":1284,"stargazers_count":13,"watchers_count":13,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":5,"open_issues":16,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/argoproj/argo-cd/pulls/96"},"html":{"href":"https://github.com/argoproj/argo-cd/pull/96"},"issue":{"href":"https://api.github.com/repos/argoproj/argo-cd/issues/96"},"comments":{"href":"https://api.github.com/repos/argoproj/argo-cd/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/argoproj/argo-cd/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/argoproj/argo-cd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/argoproj/argo-cd/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/argoproj/argo-cd/statuses/d8741d4f673c24bbf4d527b9820f8ce63c4fcf86"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"merenbach"}}