Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何在基于令牌的Web API身份验证中使用户的令牌过期_Asp.net_Asp.net Web Api_Asp.net Web Api2_Access Token - Fatal编程技术网

Asp.net 如何在基于令牌的Web API身份验证中使用户的令牌过期

Asp.net 如何在基于令牌的Web API身份验证中使用户的令牌过期,asp.net,asp.net-web-api,asp.net-web-api2,access-token,Asp.net,Asp.net Web Api,Asp.net Web Api2,Access Token,最近,我为我的Web API项目创建了基于令牌的身份验证,在这里,我可以创建令牌并验证令牌。但是,当用户注销时,我们正在从用户设备中删除令牌,如果用户在我们删除该令牌之前保存了该令牌,则该令牌在到达到期时间之前仍然有效,这会降低API的安全性 任何人都可以建议如何使已发行的令牌过期。(因为我们有庞大的用户数据库,所以我们不在数据库中存储任何令牌。)这篇文章描述了问题和可能的方法。保持令牌生命周期短,需要时刷新,可能在某种快速访问存储中维护“令牌撤销列表”- You can clear cooki

最近,我为我的Web API项目创建了基于令牌的身份验证,在这里,我可以创建令牌并验证令牌。但是,当用户注销时,我们正在从用户设备中删除令牌,如果用户在我们删除该令牌之前保存了该令牌,则该令牌在到达到期时间之前仍然有效,这会降低API的安全性


任何人都可以建议如何使已发行的令牌过期。(因为我们有庞大的用户数据库,所以我们不在数据库中存储任何令牌。)

这篇文章描述了问题和可能的方法。保持令牌生命周期短,需要时刷新,可能在某种快速访问存储中维护“令牌撤销列表”-
You can clear cookies and entire session if exists any !


Request.GetOwinContext().Authentication.SignOut();

 Request.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie);

HttpContext.Current.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie)