设置OWIN动态(按域) [英] Setup OWIN dynamically (by domain)

查看:108
本文介绍了设置OWIN动态(按域)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正试图安装在我们的项目中使用OWIN的白色标签(包括FB,谷歌,现场登录)。有没有办法设置自己的API证书动态,说,如果他们改变域中的设置会改变。

We are trying to setup a white label on our project that uses OWIN(includes FB, google, Live logins). Is there a way to setup their API credential dynamically, say if they changes the domain the settings will change.

我觉得比MVC早期owin负荷?有没有办法,我们可以加载它Global.asax中(请求)?

I think owin loads earlier than MVC? Is there a way that we can load it on Global.asax(Request)?

public partial class Startup
{
    public void Configuration(IAppBuilder app)
    {
        ConfigureAuth(app);
    }
}

更新:

在换句话说单一应用将举办多个域和子域(白色标签)。

In other words a single Application will host many domains and sub domains(white labeling).

推荐答案

我在同样的事情,今天被谷歌搜索。然后我发现在一个不错的OWIN样品<一个href=\"http://aspnet.$c$cplex.com/SourceControl/latest#Samples/Katana/BranchingPipelines/BranchingPipelines.sln\" rel=\"nofollow\">http://aspnet.$c$cplex.com/SourceControl/latest#Samples/Katana/BranchingPipelines/BranchingPipelines.sln这解释了OWIN的分枝能力。如果我没有理解这个例子中,你应该能够配置不同OWIN栈根据请求参数,如主机头,饼干,路径或任何使用app.Map()或app.MapWhen()方法。

I have been googling on the same things today. Then I found a nice OWIN sample at http://aspnet.codeplex.com/SourceControl/latest#Samples/Katana/BranchingPipelines/BranchingPipelines.sln that explained the branching capabilities of OWIN. If I understand this sample correctly, you should be able to configure different OWIN stacks depending on request parameters such as host header, cookie, path or whatever using the app.Map() or app.MapWhen() methods.

假设你有2个不同的DNS域重新presenting 2的客户提供不同的登录CONFIGS,可以初始化OWIN使用取决于主机头的值不同CONFIGS:

Let's say you have 2 different DNS domains representing 2 customers with different login configs, you can initialize OWIN to use different configs depending on the value of the host header:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {

        app.MapWhen(ctx => ctx.Request.Headers.Get("Host").Equals("customer1.cloudservice.net"), app2 =>
        {
            app2.UseWsFederationAuthentication(...);
        });
        app.MapWhen(ctx => ctx.Request.Headers.Get("Host").Equals("customer2.cloudservice.net"), app2 =>
        {
            app2.UseGoogleAuthentication(...);
        });
    }
}

这篇关于设置OWIN动态(按域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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