Cookies 如何使用多个CookieAuthenticationOptions?

Cookies 如何使用多个CookieAuthenticationOptions?,cookies,owin,Cookies,Owin,在我的OWINStartup代码中有两个CookieAuthentication选项,但只有第一个得到了认可 我找不到任何信息。如果有人能帮助我,如果这是可能的话,我会非常感激。这是我的密码: app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); // Enable clients to authenticate using cooki

在我的OWINStartup代码中有两个CookieAuthentication选项,但只有第一个得到了认可

我找不到任何信息。如果有人能帮助我,如果这是可能的话,我会非常感激。这是我的密码:

        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        // Enable clients to authenticate using cookies
        var cookieOptions = new CookieAuthenticationOptions
        {
            AuthenticationType = "type1",
            LoginPath = new PathString("/"),
            SlidingExpiration = true,
            Provider =
                    new CookieAuthenticationProvider
                    {
                        OnValidateIdentity = OnValidateIdentityAsync,
                        OnException = OnCookieException,
                        OnResponseSignIn = OnResponseSignIn,
                    },
        };

        // For auth tokens to properly work for both delve.office.com and <region>.delve.office.com
        // we use a separate auth cookie per region/deployment.
        if (!IsDevBox.Value)
        {
            cookieOptions.CookieName = AuthCookieNameWithoutSuffix + CookieHelper.GetCookieSuffix();
            cookieOptions.CookieDomain = AuthCookieDomain;
        }

        // Enable clients to authenticate using cookies
        var cookieOptions_BearerToken = new CookieAuthenticationOptions
        {
            AuthenticationType = "type2",
            CookieName = "BearerToken",
            LoginPath = new PathString("/"),
            SlidingExpiration = true,
            Provider =
                    new CookieAuthenticationProvider
                    {
                        OnValidateIdentity = OnValidateIdentityAsync_BearerToken,
                        OnException = OnCookieException,
                        OnResponseSignIn = OnResponseSignIn,
                    },
        };

        app.UseCookieAuthentication(cookieOptions);
        app.UseCookieAuthentication(cookieOptions_BearerToken);
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
//允许客户端使用cookie进行身份验证
var cookieOptions=新的CookieAuthenticationOptions
{
AuthenticationType=“type1”,
LoginPath=新路径字符串(“/”,
slidengexpiration=true,
提供者=
新CookieAuthenticationProvider
{
OnValidateIdentity=OnValidateIdentityAsync,
OnException=OnCookieException,
OnResponseSignIn=OnResponseSignIn,
},
};
//用于验证令牌在dellve.office.com和.dellve.office.com上正常工作
//我们对每个区域/部署使用单独的身份验证cookie。
如果(!IsDevBox.Value)
{
cookieOptions.CookieName=AuthCookieNameWithoutSuffix+CookieHelper.GetCookieSuffix();
cookieOptions.CookieDomain=AuthCookieDomain;
}
//允许客户端使用cookie进行身份验证
var cookieOptions\u BearerToken=新的CookieAuthenticationOptions
{
AuthenticationType=“type2”,
CookieName=“BearerToken”,
LoginPath=新路径字符串(“/”,
slidengexpiration=true,
提供者=
新CookieAuthenticationProvider
{
OnValidateIdentity=OnValidateIdentityAsync\u BearerToken,
OnException=OnCookieException,
OnResponseSignIn=OnResponseSignIn,
},
};
应用程序UseCookieAuthentication(cookieOptions);
应用程序:使用CookieAuthentication(cookieOptions\u Bearnertoken);
如果我只是使用BealerToken选项,它是有效的——但在上面的例子中,它没有得到尊重。有什么想法吗

非常感谢