I am using ComponentSpace SAML2 SSO Nuget package for ASP.net core in my ASP.net core web application where i need to have multiple SAML configurations to support different clients with different SAML configurations. I am loading the SAML Configurations from a database table and I am populating the samlConfigurations.Configurations property with the list of SamlConfigurations. For each SAMLConfiguration, i am setting the ID from the database table as the ID of the SAML Configuration so that i can set which SAML Configuration to use for each user that is trying to login.
I have SingleSignOn() method in my AccountController that would initiate the Sso. just before initiating the SSO i am setting the Saml Configuratin Id using the SetConfigurationIDAsync() method. The code looks like this.
public async Task SingleSignOn(Operator oper)
{
int samlIdpConfigId;
if (oper.SamlIdpConfigId != null)
{
samlIdpConfigId = (int) oper.SamlIdpConfigId;
}
else
{
samlIdpConfigId = oper.MasterEngagement.SamlIdpConfigId ?? -1;
}
if (samlIdpConfigId < 0)
{
throw new SecurityException(“Invalid SamlIdpConfigId found”);
}
await _samlServiceProvider.SetConfigurationIDAsync(samlIdpConfigId.ToString());
var partnetName = _configuration.GetValue(Constants.AppSetting.PartnerName);
await _samlServiceProvider.InitiateSsoAsync(partnetName);
return new EmptyResult();
}
The problem is the Configuration ID does not seem to be set properly. In the ASP.net core logs that are generated i see the following lines form the ComponentSpace library.
fail: ComponentSpace.Saml2.SamlServiceProvider[100]
Initiation of SSO to the partner identity provider http://MockIdentityProvider has failed.
ComponentSpace.Saml2.Exceptions.SamlConfigurationException: Multiple SAML configurations exist but a configuration ID hasn’t been specified.
at ComponentSpace.Saml2.Configuration.SamlConfigurations.GetConfiguration(String configurationID)
at ComponentSpace.Saml2.SamlProvider.GetSamlConfiguration()
at ComponentSpace.Saml2.SamlServiceProvider.d__5.MoveNext()
fail: ComponentSpace.Saml2.SamlServiceProvider[100]
Initiation of SSO to the partner identity provider http://MockIdentityProvider has failed.
ComponentSpace.Saml2.Exceptions.SamlConfigurationException: Multiple SAML configurations exist but a configuration ID hasn’t been specified.
at ComponentSpace.Saml2.Configuration.SamlConfigurations.GetConfiguration(String configurationID)
at ComponentSpace.Saml2.SamlProvider.GetSamlConfiguration()
at ComponentSpace.Saml2.SamlServiceProvider.d__5.MoveNext()
I can not find any examples or material on how to fix this or how to do this properly if i am doing something wrong. Some help would be much appreciated
My apologies for this. I can confirm this is a bug in the 1.0.0 release which was rectified in 1.0.1. This is available either from our web site or NuGet.
Let us know if there’s still an issue.
[quote][/quote]
My apologies for this. I can confirm this is a bug in the 1.0.0 release which was rectified in 1.0.1. This is available either from our web site or NuGet.
Let us know if there's still an issue.
Let us know if there's still an issue.
Everything worked perfectly after the Nuget package update. Thank you for the quick response. :)
You’re welcome.