最近,我在Article之后为我的Web API项目创建了基于令牌的身份验证,在这里我能够创建令牌并能够验证令牌。但是,当用户注销时,我们正在从用户设备中删除令牌,如果用户在删除令牌之前保存了令牌,该令牌在到期之前仍然有效,这会导致API的安全性降低
有人可以建议我如何使已发行的令牌到期。(由于我们拥有庞大的用户数据库,因此我们不会在数据库中存储任何令牌。)
答案 0 :(得分:0)
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)