인증 용 OWIN 미들웨어가 있습니다. 두 가지 유형의 인증이 있습니다. 사용자 로그 아웃, 우리는 실제로 두 개의 로그 아웃OWIN 인증, 현재 토큰 만료 및 쿠키 제거
Request.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
을 실행하면 첫 번째 유형은 외부 로그인
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive,
CookieHttpOnly = true,
CookieSecure = CookieSecureOption.SameAsRequest,
CookieName = ".AspNet." + DefaultAuthenticationTypes.ExternalCookie,
ExpireTimeSpan = TimeSpan.FromMinutes(5),
TicketDataFormat = new SecureTokenFormatter(GetMachineKey())
});
에 대한 다음과 같은 구성
var OAuthOptions = new OAuthAuthorizationServerOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalBearer,
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
AllowInsecureHttp = true,
AccessTokenFormat = new SecureTokenFormatter(GetMachineKey())
};
그리고 두 번째 유형 사용 인증 쿠키를 사용하여 베어러 토큰 및
Request.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ExternalBearer);
처음에는 브라우저에서 .AspNet.ExternalCookie 쿠키가 삭제 될 것으로 예상됩니다. 둘째로, 내 토큰을 무효화하고 User.Current.Identity = null을 기대하고 있습니다. 그렇지 않습니다.
어떻게 할 수 있습니까? 1) 현재 세션의 현재 ID를 물리적으로 로그 아웃 하시겠습니까? 2) 브라우저에서 외부 쿠키를 제거 하시겠습니까?
나는 같은 문제를 해결 : Request.GetOwinContext(). Authentication.SignOut (DefaultAuthenticationTypes.ApplicationCookie); FederatedAuthentication.SessionAuthenticationModule.SignOut(); – Alex