且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ServiceStack - 域和子域的身份验证

更新时间:2023-12-01 13:55:22

我通过以下内容解决了我的问题 拉取请求.

在 Web.config 中,您可以为您的 cookie 指定域.ServiceStack 正在覆盖这个值,但现在如果指定了它,ServiceStack 将不理会它.

<system.web><httpCookies domain=".domain.com"/></system.web></配置>

I want to host the ServiceStack authentication providers on the root of a domain (domain.com) and have the authentication work for the entire domain (sub1.domain.com, sub2.domain.com).

Is it possible to replace the default implementation of ICookies with my own so I can set domain in the cookies?

I am seeing that HttpResponseWrapper instantiates the default implementation so I am guessing no.

Is there another approach?

I addressed my issue with the following pull request.

In Web.config, you can specify the domain for your cookies. ServiceStack was overwriting this value, but now ServiceStack will leave it alone if it is specified.

<configuration>
  <system.web>
    <httpCookies domain=".domain.com" />
  </system.web>
</configuration>