Hello all,
The situation is that we have multiple customers using an enterprise connection next to multiple customers using the universal login. The ones with an enterprise connection all get there own subdomain that should redirect to their enterprise connection.
In my .NET application I have this endpoint:
public ActionResult Login(string returnUrl)
{
string subdomain = HttpContext.Request.Url.Host.Split('.')[0];
AuthenticationProperties authProperties = new AuthenticationProperties();
if (subdomain == "subdomain-one")
{
var clientId = ConfigurationManager.AppSettings["auth0:ClientId"];
var redirectUri = ConfigurationManager.AppSettings["auth0:RedirectUri"];
authProperties.Dictionary.Add("connection", "subdomain-one-auth0-sso");
authProperties.Dictionary.Add("response_type", "code");
authProperties.Dictionary.Add("client_id", clientId);
authProperties.Dictionary.Add("redirect_uri", redirectUri);
}
else
{
var redirectUri = returnUrl ?? Url.Action("Index", "Home");
authProperties.RedirectUri = redirectUri;
}
HttpContext.GetOwinContext().Authentication.Challenge(authProperties, "Auth0");
return new HttpUnauthorizedResult();
}
The authProperties will be filled with the connection parameter after it passes that line, but the url generated will not have this parameter.
The reason why “authProperties.Dictionary.Add(“connection”, “pactum-auth0-sso”);” is not working is because this parameter is being sent towards the OIDC request but not towards the /authorize request in Auth0.
What can I do to solve this or is there an alternative way to set this up?
I have seen a solution doing this on startup.cs, but since we want this dynamically based on subdomain this is not workable for us.