I am attempting to author my first ADFS-enabled ASP.Net web app. The app works fine when hosted on my local machine, but when I publish it to IIS, which is behind an SSL proxy, my app ends up redirecting the authenticated user to the http address of the application, instead of the https address. How do I address this?
To clarify where the process breaks down, here is what is happening:
- Unauthenticated user browses to home page of app and is redirected to Idp [good]
- User authenticates at Idp, and the token is sent via https POST back to my app [good]
- My app assigns a cookie, and redirects the user to the http home page [bad]
In my Startup.Auth.cs, I am just using the boilerplate code:
public partial class Startup
{
private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = adfsMetadata
});
}
}
I've read several posts about similar issues with identity/auth behind an ssl proxy and the advice to assign a custom CookieAuthenticationProvider had no affect for me. I'm guessing because the redirect is being performed by the ws-fed middleware rather than the cookie provider.