{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Security/pulls/comments/111851306","pull_request_review_id":33122005,"id":111851306,"diff_hunk":"@@ -1,32 +1,97 @@\n // Copyright (c) .NET Foundation. All rights reserved.\n // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n \n-\n using System;\n using System.Linq;\n using System.Security.Claims;\n+using System.Text.Encodings.Web;\n using System.Threading.Tasks;\n-using Microsoft.AspNetCore.Builder;\n+using Microsoft.AspNetCore.DataProtection;\n using Microsoft.AspNetCore.Http;\n-using Microsoft.AspNetCore.Http.Authentication;\n using Microsoft.AspNetCore.Http.Features;\n-using Microsoft.AspNetCore.Http.Features.Authentication;\n+using Microsoft.Extensions.DependencyInjection;\n+using Microsoft.Extensions.Logging;\n+using Microsoft.Extensions.Options;\n using Microsoft.Net.Http.Headers;\n \n namespace Microsoft.AspNetCore.Authentication.Cookies\n {\n-    internal class CookieAuthenticationHandler : AuthenticationHandler<CookieAuthenticationOptions>\n+    public class CookieAuthenticationHandler : AuthenticationHandler<CookieAuthenticationOptions>\n     {\n         private const string HeaderValueNoCache = \"no-cache\";\n         private const string HeaderValueMinusOne = \"-1\";\n         private const string SessionIdClaim = \"Microsoft.AspNetCore.Authentication.Cookies-SessionId\";\n \n         private bool _shouldRefresh;\n+        private bool _signInCalled;\n+        private bool _signOutCalled;\n+\n         private DateTimeOffset? _refreshIssuedUtc;\n         private DateTimeOffset? _refreshExpiresUtc;\n         private string _sessionKey;\n         private Task<AuthenticateResult> _readCookieTask;\n \n+        public CookieAuthenticationHandler(IOptionsSnapshot<CookieAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock)\n+            : base(options, logger, encoder, clock)\n+        { }\n+\n+        /// <summary>\n+        /// The handler calls methods on the events which give the application control at certain points where processing is occurring. \n+        /// If it is not provided a default instance is supplied which does nothing when the methods are called.\n+        /// </summary>\n+        protected new CookieAuthenticationEvents Events\n+        {\n+            get { return (CookieAuthenticationEvents)base.Events; }\n+            set { base.Events = value; }\n+        }\n+\n+        public override async Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)\n+        {\n+            await base.InitializeAsync(scheme, context);","path":"src/Microsoft.AspNetCore.Authentication.Cookies/CookieAuthenticationHandler.cs","position":55,"original_position":55,"commit_id":"542f5ee1c7db1f8eef50b2cafe990be6c25b5eba","original_commit_id":"542f5ee1c7db1f8eef50b2cafe990be6c25b5eba","user":{"login":"HaoK","id":6537861,"avatar_url":"https://avatars1.githubusercontent.com/u/6537861?v=3","gravatar_id":"","url":"https://api.github.com/users/HaoK","html_url":"https://github.com/HaoK","followers_url":"https://api.github.com/users/HaoK/followers","following_url":"https://api.github.com/users/HaoK/following{/other_user}","gists_url":"https://api.github.com/users/HaoK/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoK/subscriptions","organizations_url":"https://api.github.com/users/HaoK/orgs","repos_url":"https://api.github.com/users/HaoK/repos","events_url":"https://api.github.com/users/HaoK/events{/privacy}","received_events_url":"https://api.github.com/users/HaoK/received_events","type":"User","site_admin":false},"body":"Or are you just asking for us to make it impossible to call base via a separate virtual for children to implement.\r\n\r\nInitializeAsync(scheme, context) => // do stuff, then call protected virtual InitializeAsync() { } ","created_at":"2017-04-18T00:42:47Z","updated_at":"2017-04-18T00:42:47Z","html_url":"https://github.com/aspnet/Security/pull/1170#discussion_r111851306","pull_request_url":"https://api.github.com/repos/aspnet/Security/pulls/1170","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Security/pulls/comments/111851306"},"html":{"href":"https://github.com/aspnet/Security/pull/1170#discussion_r111851306"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Security/pulls/1170"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Security/pulls/1170","id":113718803,"html_url":"https://github.com/aspnet/Security/pull/1170","diff_url":"https://github.com/aspnet/Security/pull/1170.diff","patch_url":"https://github.com/aspnet/Security/pull/1170.patch","issue_url":"https://api.github.com/repos/aspnet/Security/issues/1170","number":1170,"state":"open","locked":false,"title":"Iteration 4 - Using Auth 2.0/Options 2.0 packages","user":{"login":"HaoK","id":6537861,"avatar_url":"https://avatars1.githubusercontent.com/u/6537861?v=3","gravatar_id":"","url":"https://api.github.com/users/HaoK","html_url":"https://github.com/HaoK","followers_url":"https://api.github.com/users/HaoK/followers","following_url":"https://api.github.com/users/HaoK/following{/other_user}","gists_url":"https://api.github.com/users/HaoK/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoK/subscriptions","organizations_url":"https://api.github.com/users/HaoK/orgs","repos_url":"https://api.github.com/users/HaoK/repos","events_url":"https://api.github.com/users/HaoK/events{/privacy}","received_events_url":"https://api.github.com/users/HaoK/received_events","type":"User","site_admin":false},"body":"Previous PR: https://github.com/aspnet/Security/pull/1151\r\n\r\n@Tratcher clean PR to start with, rebased and using the Http Abstractions/Options 2.0 interfaces","created_at":"2017-03-31T19:41:30Z","updated_at":"2017-04-18T00:42:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"880b4ac9c11c4e68dc631a295747e9909080d554","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Security/pulls/1170/commits","review_comments_url":"https://api.github.com/repos/aspnet/Security/pulls/1170/comments","review_comment_url":"https://api.github.com/repos/aspnet/Security/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Security/issues/1170/comments","statuses_url":"https://api.github.com/repos/aspnet/Security/statuses/542f5ee1c7db1f8eef50b2cafe990be6c25b5eba","head":{"label":"aspnet:haok/auth2","ref":"haok/auth2","sha":"542f5ee1c7db1f8eef50b2cafe990be6c25b5eba","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":17723699,"name":"Security","full_name":"aspnet/Security","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Security","description":"Middleware for security and authorization of web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Security","forks_url":"https://api.github.com/repos/aspnet/Security/forks","keys_url":"https://api.github.com/repos/aspnet/Security/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Security/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Security/teams","hooks_url":"https://api.github.com/repos/aspnet/Security/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Security/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Security/events","assignees_url":"https://api.github.com/repos/aspnet/Security/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Security/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Security/tags","blobs_url":"https://api.github.com/repos/aspnet/Security/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Security/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Security/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Security/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Security/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Security/languages","stargazers_url":"https://api.github.com/repos/aspnet/Security/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Security/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Security/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Security/subscription","commits_url":"https://api.github.com/repos/aspnet/Security/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Security/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Security/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Security/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Security/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Security/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Security/merges","archive_url":"https://api.github.com/repos/aspnet/Security/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Security/downloads","issues_url":"https://api.github.com/repos/aspnet/Security/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Security/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Security/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Security/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Security/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Security/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Security/deployments","created_at":"2014-03-13T19:44:34Z","updated_at":"2017-04-16T09:51:59Z","pushed_at":"2017-04-17T23:18:23Z","git_url":"git://github.com/aspnet/Security.git","ssh_url":"git@github.com:aspnet/Security.git","clone_url":"https://github.com/aspnet/Security.git","svn_url":"https://github.com/aspnet/Security","homepage":"","size":3876,"stargazers_count":517,"watchers_count":517,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":269,"mirror_url":null,"open_issues_count":83,"forks":269,"open_issues":83,"watchers":517,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"2d7cd6038fea34b84084685648ac9d0c97be610b","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":17723699,"name":"Security","full_name":"aspnet/Security","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Security","description":"Middleware for security and authorization of web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Security","forks_url":"https://api.github.com/repos/aspnet/Security/forks","keys_url":"https://api.github.com/repos/aspnet/Security/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Security/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Security/teams","hooks_url":"https://api.github.com/repos/aspnet/Security/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Security/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Security/events","assignees_url":"https://api.github.com/repos/aspnet/Security/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Security/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Security/tags","blobs_url":"https://api.github.com/repos/aspnet/Security/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Security/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Security/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Security/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Security/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Security/languages","stargazers_url":"https://api.github.com/repos/aspnet/Security/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Security/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Security/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Security/subscription","commits_url":"https://api.github.com/repos/aspnet/Security/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Security/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Security/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Security/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Security/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Security/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Security/merges","archive_url":"https://api.github.com/repos/aspnet/Security/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Security/downloads","issues_url":"https://api.github.com/repos/aspnet/Security/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Security/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Security/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Security/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Security/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Security/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Security/deployments","created_at":"2014-03-13T19:44:34Z","updated_at":"2017-04-16T09:51:59Z","pushed_at":"2017-04-17T23:18:23Z","git_url":"git://github.com/aspnet/Security.git","ssh_url":"git@github.com:aspnet/Security.git","clone_url":"https://github.com/aspnet/Security.git","svn_url":"https://github.com/aspnet/Security","homepage":"","size":3876,"stargazers_count":517,"watchers_count":517,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":269,"mirror_url":null,"open_issues_count":83,"forks":269,"open_issues":83,"watchers":517,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Security/pulls/1170"},"html":{"href":"https://github.com/aspnet/Security/pull/1170"},"issue":{"href":"https://api.github.com/repos/aspnet/Security/issues/1170"},"comments":{"href":"https://api.github.com/repos/aspnet/Security/issues/1170/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Security/pulls/1170/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Security/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Security/pulls/1170/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Security/statuses/542f5ee1c7db1f8eef50b2cafe990be6c25b5eba"}}}}
{"actor":{"display_login":"HaoK"}}