ServiceStack - 域和子域的身份验证 [英] ServiceStack - Authentication for domain and subdomains

查看:43
本文介绍了ServiceStack - 域和子域的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在域 (domain.com) 的根目录上托管 ServiceStack 身份验证提供程序,并为整个域(sub1.domain.com、sub2.domain.com)进行身份验证.

是否可以将 ICookies 的默认实现替换为我自己的实现,以便我可以在 cookie 中设置域?

我看到 HttpResponseWrapper 实例化了默认实现,所以我猜不是.

还有其他方法吗?

解决方案

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

在 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>

这篇关于ServiceStack - 域和子域的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆