{"action":"reopened","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/8021","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/8021/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/8021/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/8021/events","html_url":"https://github.com/aspnet/Mvc/issues/8021","id":338947422,"node_id":"MDU6SXNzdWUzMzg5NDc0MjI=","number":8021,"title":"Integration testing SignOutAsync problem?","user":{"login":"Tealons","id":7141563,"node_id":"MDQ6VXNlcjcxNDE1NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/7141563?v=4","gravatar_id":"","url":"https://api.github.com/users/Tealons","html_url":"https://github.com/Tealons","followers_url":"https://api.github.com/users/Tealons/followers","following_url":"https://api.github.com/users/Tealons/following{/other_user}","gists_url":"https://api.github.com/users/Tealons/gists{/gist_id}","starred_url":"https://api.github.com/users/Tealons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tealons/subscriptions","organizations_url":"https://api.github.com/users/Tealons/orgs","repos_url":"https://api.github.com/users/Tealons/repos","events_url":"https://api.github.com/users/Tealons/events{/privacy}","received_events_url":"https://api.github.com/users/Tealons/received_events","type":"User","site_admin":false},"labels":[{"id":188063138,"node_id":"MDU6TGFiZWwxODgwNjMxMzg=","url":"https://api.github.com/repos/aspnet/Mvc/labels/investigate","name":"investigate","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":{"login":"javiercn","id":6995051,"node_id":"MDQ6VXNlcjY5OTUwNTE=","avatar_url":"https://avatars2.githubusercontent.com/u/6995051?v=4","gravatar_id":"","url":"https://api.github.com/users/javiercn","html_url":"https://github.com/javiercn","followers_url":"https://api.github.com/users/javiercn/followers","following_url":"https://api.github.com/users/javiercn/following{/other_user}","gists_url":"https://api.github.com/users/javiercn/gists{/gist_id}","starred_url":"https://api.github.com/users/javiercn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiercn/subscriptions","organizations_url":"https://api.github.com/users/javiercn/orgs","repos_url":"https://api.github.com/users/javiercn/repos","events_url":"https://api.github.com/users/javiercn/events{/privacy}","received_events_url":"https://api.github.com/users/javiercn/received_events","type":"User","site_admin":false},"assignees":[{"login":"javiercn","id":6995051,"node_id":"MDQ6VXNlcjY5OTUwNTE=","avatar_url":"https://avatars2.githubusercontent.com/u/6995051?v=4","gravatar_id":"","url":"https://api.github.com/users/javiercn","html_url":"https://github.com/javiercn","followers_url":"https://api.github.com/users/javiercn/followers","following_url":"https://api.github.com/users/javiercn/following{/other_user}","gists_url":"https://api.github.com/users/javiercn/gists{/gist_id}","starred_url":"https://api.github.com/users/javiercn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiercn/subscriptions","organizations_url":"https://api.github.com/users/javiercn/orgs","repos_url":"https://api.github.com/users/javiercn/repos","events_url":"https://api.github.com/users/javiercn/events{/privacy}","received_events_url":"https://api.github.com/users/javiercn/received_events","type":"User","site_admin":false}],"milestone":null,"comments":12,"created_at":"2018-07-06T13:51:12Z","updated_at":"2018-07-19T17:45:12Z","closed_at":null,"author_association":"NONE","body":"I have enabled integration testing according to the following docs: [https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.1](https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.1)\r\n\r\nNow I want to simulate logging out of the application. The test looks like this:\r\n\r\n```\r\n[Fact, TestPriority(3)]\r\npublic async Task LogoutFromApplication()\r\n{\r\n        var defaultPage = await _client.GetAsync(\"/\");\r\n        IHtmlDocument responseContent = await HtmlHelpers.GetDocumentAsync(defaultPage);\r\n\r\n        var response = await _client.SendAsync(\r\n            (IHtmlFormElement)responseContent.QuerySelector(\"form[id='logout_form']\"));\r\n        var body = await response.Content.ReadAsStringAsync();\r\n}\r\n```\r\n\r\nAnd the logout method like this: \r\n\r\n  ```\r\n[HttpPost]\r\n[ValidateAntiForgeryToken]\r\npublic async Task<IActionResult> Logout()\r\n{\r\n       await _signInManager.SignOutAsync();\r\n       _logger.LogInformation(4, \"User logged out.\");\r\n       return RedirectToAction(nameof(HomeController.Index), \"Home\");\r\n}\r\n```\r\n\r\nIn the application startup.cs we have the following policy:\r\n\r\n```\r\n services.AddMvc(config =>\r\n            {\r\n                var policy = new AuthorizationPolicyBuilder(JwtBearerDefaults.AuthenticationScheme, IdentityConstants.ApplicationScheme)\r\n                    .RequireAuthenticatedUser()\r\n                    .Build();\r\n                config.Filters.Add(new AuthorizeFilter(policy));\r\n            });\r\n```\r\n\r\nThe logout method is hit by the test, but the redirect does not cause the login screen to appear, which should because of the mvc policy in our startup.cs.  Instead the normal index page is shown. It looks like the identity cookie is not removed from the client. Does anyone know what is happening here? Or am I missing something completely?\r\n"}}
{"actor":{"display_login":"javiercn"}}