4
一個ASP MVC網站IIS。該網站用身份識別服務器以非正式流程對用戶進行身份驗證。
有多個域被攻擊。所以該網站是從不同的域名。例如
。
- foo.com
- foo.de
- foo.fr
問題
現在,當我配置我的網站,我必須設置重定向URL,但它取決於關於用戶來自哪裏。但是,由於此配置是在應用程序啓動時完成的,因此根據傳入的請求我無法改變。
這是什麼推薦的方法?
public static void Configure(IAppBuilder app)
{
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "oidc",
Authority = ConfigurationManager.AppSettings["authority"],
ClientId = "BlsFrontend",
RedirectUri = "http://foo.de", //how to get this dynamically?
ResponseType = "id_token token",
SignInAsAuthenticationType = "Cookies",
Scope = "openid profile",
有一件事我在考慮是使用RedirectToIdentityProvider
通知和adpot在請求重定向。我測試過它,它適用於我的情況,但這是否是一種有效/好的方法?
RedirectToIdentityProvider = n =>
{
if (!string.IsNullOrWhiteSpace(n.ProtocolMessage.RedirectUri))
{
n.ProtocolMessage.RedirectUri = n.Request.Scheme + "://" + n.Request.Host.ToString(); //How to make it clean !?
}
}
這是正確的方式,RedirectUri由權威機構驗證。 –