Owin uses external shapes.

So, I think my problem will be that I have one MVC website using standard authentication and one MVC that is more focused on ASP.NET authentication.

What I am trying to do is configure my Owin authentication to read and accept the auth cookie generated by the standard MVC site. Everything is set up like below, but I just can't get Ovin to accept the cookie.

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))
    }
});

      

+3


source to share


1 answer


What you are trying to accomplish is not possible. The intermediate cookie authenticator is claims-based and orders all authentication requirements into an authentication ticket in a cookie. Form authentication stores the username and some additional details, but it knows nothing about the claims. Basically, the authentication ticket that is placed inside the cookie is completely different in both cases, and you won't be able to get the cookie authentication middleware by reading the ticket generated by the FAM or vice versa.



+4


source







All Articles