Implementation of Identity Provider Programatically


I am using Component Space Webforms for Identity Provider and Service Provider. I have configured Identify provider programatically, instead of SAML config. I have troubles in embedding the certificate file to the identity provider. When i Try to receive sso I am getting Saml Configuration Exception.

An X.509 certificate for the partner identity provider MyTest hasn’t been configured.

Below is My IDP configuration.

PartnerIdentityProviderConfiguration identityConfiguration = new PartnerIdentityProviderConfiguration();
identityConfiguration.Name = dt.Rows[0][“IdpName”].ToString();
identityConfiguration.SignAuthnRequest = false;
identityConfiguration.WantSAMLResponseSigned = true;
identityConfiguration.WantAssertionSigned = false;
identityConfiguration.WantAssertionEncrypted = false;
identityConfiguration.SingleSignOnServiceUrl = dt.Rows[0][“SingleSignOnServiceUrl”].ToString();
identityConfiguration.SingleLogoutServiceUrl = dt.Rows[0][“SingleLogoutServiceUrl”].ToString();
identityConfiguration.LocalCertificateFile = “idp.cer”;

Even I tried “PartnerCertificateFile”.

Let me know if any further details required.

You should use the PartnerCertificateFile property. For example:
identityConfiguration.PartnerCertificateFile = “idp.cer”;
Please try that again. If there’s still an issue, include your code as well as the exact exception message being thrown.

Yes that worked. But after that i received the error Local service provider is not configured. But I have configured the Service Provider in SAML.config which is not at all picked up.

But when i add the below line on my code it works perfectly.

samlConfiguration.LocalServiceProviderConfiguration = new LocalServiceProviderConfiguration()
Name = “urn:componentspace:ExampleServiceProvider”,
AssertionConsumerServiceUrl = “~/SAML/AssertService.aspx”,
LocalCertificateFile = “sp.pfx”,
LocalCertificatePassword = “password”

Is that possible to make the SAML.config to be picked up rather than using the above code.

I have Service Provider on my Saml.Config and Identity Provider is done programatically.

You can’t mix the saml.config with programmatically specified configuration. You either have to use a saml.config or programmatically specify the SAML configuration. You can’t do both.

Ok, Thanks