Closed atishayjain closed 4 years ago
Explored the library, got the solution and it is minor addition
var config = new Saml2Configuration
{
ServiceProvider = new ServiceProvider
{
SigningCertificate = new X509Certificate2(X509Certificate.CreateFromCertFile(certPath)),
Server = Settings.Default.SPName,
Id = Settings.Default.SPName
},
AllowedAudienceUris = new List<Uri>(new[] { new Uri(Settings.Default.SPName) })
};
// The following URLs are based on the defaults used by the middleware above
config.ServiceProvider.Endpoints.AddRange(new[] {
new ServiceProviderEndpoint(EndpointType.SignOn, "/login", "/login", BindingType.Post),
new ServiceProviderEndpoint(EndpointType.Logout, "/logout", "/logout"),
new ServiceProviderEndpoint(EndpointType.Metadata, "/metadata")
});
config.IdentityProviders.AddByMetadata(metaDataFilePath);
config.IdentityProviders.First().OmitAssertionSignatureCheck = true;
config.LoggingFactoryType = "SAML2.Logging.DebugLoggerFactory";
app.UseSamlAuthentication(new SamlAuthenticationOptions
{
AuthenticationType = provider.AuthProviderKey,
RedirectAfterLogin = provider.CallBackUrl,
AuthenticationMode = AuthenticationMode.Passive,
Configuration = config
});