public void VerifyAccessTokenRevocation() { var validToken = "valid_access_token"; _Server.Reset(); _Server.Given( Request.Create().UsingPost() .WithHeader("Authorization", "Bearer " + validToken) .WithPath("/ggdghornl_test/oauth2/v1/revoke") ) .RespondWith( Response.Create() .WithStatusCode(200) .WithHeader("Content-Type", "application/json") .WithBody("{\"msg\":\"Access Token revoked\"}") ); Assert.IsTrue(_TheIdentityHubService.RevokeAccessToken(validToken).Result); }
public async Task <IActionResult> Execute(HttpContext httpContext) { if (httpContext == null) { throw new ArgumentNullException(nameof(httpContext)); } var accessToken = httpContext.User.Claims.FirstOrDefault((c => c.Type == TheIdentityHubClaimTypes.AccessToken))?.Value; if (accessToken != null) { await _TheIdentityHubService.RevokeAccessToken(accessToken); } httpContext.Response.Cookies.Delete(".AspNetCore.Cookies"); await httpContext.SignOutAsync(); return(new RedirectResult(_Configuration.FrontendBaseUrl)); }