2014-11-13 3 views
3

내 문제는 표준 양식 인증을 사용하는 하나의 MVC 웹 사이트와 ASP.NET ID에 맞게 조정 된 하나의 MVC가 될 것입니다.Owin은 외부 양식 인증 쿠키를 사용합니다.

내가하려고하는 것은 표준 MVC 폼 인증 사이트에서 생성 된 인증 쿠키를 읽고 받아들이도록 내 Owin 인증을 구성하는 것입니다. 모든 것이 아래와 같이 구성되어 있지만 Owin에게 쿠키를 허용하지는 않습니다.

app.SetDefaultSignInAsAuthenticationType(DefaultAuthenticationTypes.ExternalCookie); 
app.UseCookieAuthentication(new CookieAuthenticationOptions 
{ 
    AuthenticationType = DefaultAuthenticationTypes.ExternalCookie, 
    AuthenticationMode = AuthenticationMode.Active, 
    LoginPath = new PathString("/Account/Login"), 
    CookieHttpOnly = true, 
    CookieName = "myAuthCookie", 
    CookieDomain = ".mydomain.com", 
    CookiePath = "/", 
    Provider = new CookieAuthenticationProvider 
    { 
     // Enables the application to validate the security stamp when the user logs in. 
     // This is a security feature which is used when you change a password or add an external login to your account. 
     OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
      validateInterval: TimeSpan.FromMinutes(30), 
      regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) 
    } 
}); 

답변

4

달성하려는 작업은 불가능합니다. 쿠키 인증 미들웨어는 클레임 ​​기반이며, ID와 관련된 모든 클레임을 쿠키의 인증 티켓에 직렬화합니다. 양식 인증은 사용자 이름과 일부 추가 데이터를 저장하지만 클레임에 대해서는 아무 것도 모릅니다. 기본적으로 쿠키 안에 들어있는 인증 티켓은 두 경우 모두 완전히 다르므로 쿠키 인증 미들웨어에서 FAM에 의해 생성 된 티켓을 읽거나 그 반대로 쿠키 인증 미들웨어를 읽지 못하게됩니다.

관련 문제