0
我目前在我的多租户CMS中使用Owin 2.0。我需要一种方法来根据租户更改Facebook应用ID和秘密。在多租户网站中使用Owin OAuth 2.0
问题是Owin配置代码在执行任何其他操作之前执行。 Request.Url不是解决方案。请给我一个实用的解决方案。目前我只能通过url区分租户。
我目前在我的多租户CMS中使用Owin 2.0。我需要一种方法来根据租户更改Facebook应用ID和秘密。在多租户网站中使用Owin OAuth 2.0
问题是Owin配置代码在执行任何其他操作之前执行。 Request.Url不是解决方案。请给我一个实用的解决方案。目前我只能通过url区分租户。
使用该答案为有用的提示,而不是一个解决方案
您应该使用FacebookAuthenticationProvider
定制为每个租户完整流程。 FacebookAuthenticationProvider
有三个事件暴露,将有助于定制。
提示:在Visual Studio
FacebookAuthenticationOptions fbOptions = new FacebookAuthenticationOptions();
fbOptions.AppId = "DefaultAppId";
fbOptions.AppSecret = "DefaultSecret";
fbOptions.CallbackPath = new PathString("DefaultTenantWithCallBackUrl");
fbOptions.Provider = new FacebookAuthenticationProvider()
{
OnApplyRedirect = (FacebookApplyRedirectContext context) =>
{
/*a way to change the facebook app id and secret depending on the tenant.*/
/*Redirect to tenant specific built url */
},
OnAuthenticated = (FacebookAuthenticatedContext context) =>
{
/*process tenant specific logic*/
return Task.FromResult(0);
},
OnReturnEndpoint = (FacebookReturnEndpointContext context) =>
{
/*process tenant specific logic*/
return Task.FromResult(0);
}
};
app.Use(typeof(FacebookAuthenticationMiddleware), app, fbOptions);
使用对象浏览器谢谢你的解决方案。有效!! – eadam