简体   繁体   English

Owin CookieDomain IIS7和SSL

[英]Owin CookieDomain IIS7 and SSL

I am having a problem with setting up SSO between our apps, In the application that creates the cookie I have: 我在我们的应用程序之间设置SSO时遇到问题,在创建cookie的应用程序中,我有:

         app.UseCookieAuthentication(new CookieAuthenticationOptions
       {
          AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
          LoginPath = new PathString("/Account/Login"),
        //              LogoutPath = new PathString("/Account/Logout"),
        //              ExpireTimeSpan = TimeSpan.FromDays(1),
          CookieName = "mycookie",
          CookieDomain = ".mydomain.com",
       });

When testing this locally I get the result I expect 在本地测试时,我得到了预期的结果

Cookie = Name: mycookie, Domain: .mydomain.com Cookie =名称:mycookie,域:.mydomain.com

However when I go to our test environment I get 但是,当我进入测试环境时,

Cookie = Name: mycookie, Domain: oauth.mydomain.com Cookie =名称:mycookie,域:oauth.mydomain.com

Since the cookie has the root of the domain it does not work in the other applications. 由于cookie具有域的根,因此它无法在其他应用程序中运行。 I have done everything I can think of but it just does not seem to want to use the domain specified in the configuration. 我已经做了所有我能想到的事情,但是它似乎不想使用配置中指定的域。


Update: It appears this is a problem when hosting from an IIS7 environment when using SSL. 更新:使用SSL从IIS7环境进行托管时,这似乎是一个问题。 When not using SSL in IIS7 or when deployed to our UAT enviroment with IIS8 it works as expected. 当不在IIS7中使用SSL或将其部署到带有IIS8的UAT环境中时,它将按预期工作。

When using SSL it is also not redirecting correctly. 使用SSL时,它也无法正确重定向。 I think this problem is also related. 我认为这个问题也有关系。

When I hit http://site.domain.com I am redirected to 当我点击http://site.domain.com时,我被重定向到

http://auth.domain.com/account/login?returnUrl=site.domain.com http://auth.domain.com/account/login?returnUrl=site.domain.com

as expected, however If SSL is enabled I am redirected to 符合预期,但是如果启用了SSL,我将被重定向到

https:// site.domain.com /account/login?returnurl=site.domain.com https:// site.domain.com /account/login?returnurl=site.domain.com

因此,问题似乎出在那些位于后面的服务器的防火墙/代理中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM