Considering
ASP MVC website in IIS. The site authenticated users with an identifier server with a limited flow.
Several domains belong to it. Thus, the website is called from different domains.
eg.
Problem
Now that I am setting up my site, I have to set the redirect URL, but it depends on where the user comes from. But since this configuration is performed when the application starts, I could not change the situation depending on the incoming request.
What is the recommended approach for this?
public static void Configure(IAppBuilder app)
{
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "oidc",
Authority = ConfigurationManager.AppSettings["authority"],
ClientId = "BlsFrontend",
RedirectUri = "http://foo.de",
ResponseType = "id_token token",
SignInAsAuthenticationType = "Cookies",
Scope = "openid profile",
, , - RedirectToIdentityProvider . , , / ?
RedirectToIdentityProvider = n =>
{
if (!string.IsNullOrWhiteSpace(n.ProtocolMessage.RedirectUri))
{
n.ProtocolMessage.RedirectUri = n.Request.Scheme + "://" + n.Request.Host.ToString();
}
}