我正在尝试一个解决方案,其中一个 Web 应用程序服务于多个域,对于每个域我想配置自己的提供程序,使用外部提供程序的应用程序 ID 和秘密,我想要cookie 域和提供程序信息根据当前域名从数据库中读取,例如:
switch (currentDomainName)
{
case "web1.com": load cookie domain and providers information for web1.com ...
case "web2.com": load cookie domain and providers information for web2.com ...
...
}
我面临两个主要问题:
- 我在 Owin 启动 ConfigureAuth() 中没有可用的 HttpContext,我不确定如何确定在启动早期使用哪个域名...
- 我知道每个 Web 应用程序只运行一次 Startup,例如,在第一次访问 web1.com 后,一旦 web1.com 已经设置了 ConfigureAuth(),它就不会再次为 web2.com 运行
我想知道我是否可以覆盖一些 Owin 方法并使其成为非静态的......或者也许找到一种方法以不同的方式实现它(但我仍然喜欢使用 Owin)
我从哪说起呢?