I am trying to set up a proof of concept to move our Forms Authentication with a SQL Membership provider into a brokered authentication process. In order to do this, I am planning on leveraging Thinktecture's Identity Server 2 as the identity provider.
I have downloaded IdentityServer 2 and installed it and tried following the instructions from here: http://www.cloudidentity.com/blog/2014/02/20/ws-federation-in-microsoft-owin-componentsa-quick-start/
However, whenever I try to access a controller action which is restricted by the AuthorizeAttribute, I get an HttpResponse of 401 instead of a redirect to the IdentityServer's login page. The Startup.Auth.cs is set up with the following:
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType
});
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
MetadataAddress = "https://dvancuykidstrial.cloudapp.net/FederationMetadata/2007-06/FederationMetadata.xml"
,Wtrealm = "http://owin2.testing.com/"
,AuthenticationMode = AuthenticationMode.Passive
,BackchannelCertificateValidator = new FakeCertificateValidator()
});
}
}
Incidentally, the FakeCertificateValidator is simply an implemnentation of ICertificateValidator which merely returns true when the Validate function is invoked. This just lets me get past the self-signed certs I'm using for the PoC.
public class FakeCertificateValidator : ICertificateValidator
{
public bool Validate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
Can anyone see what I am doing wrong here?