Using IConfigResolver to generate Metadata

Currently I’m building metadata (to give to idps) manually using MetadataExporter and filling each field individually (including certs).

Is there any way to have MetadataExporter use the IConfigResolver class? I’d much rather use a DRY principal and not having to duplicate a bunch of config twice.

Are you using the ComponentSpace.Saml2.Metadata.Export.IConfigurationToMetadata interface?
The default implementation of this interface retrieves SAML configuration through the ISamlConfigurationResolver interface.
The ExportMetadata project demonstrates the use of IConfigurationToMetadata.

[quote]
ComponentSpace - 11/20/2019
Are you using the ComponentSpace.Saml2.Metadata.Export.IConfigurationToMetadata interface?
The default implementation of this interface retrieves SAML configuration through the ISamlConfigurationResolver interface.
The ExportMetadata project demonstrates the use of IConfigurationToMetadata.
[/quote]

Thanks for your response.

In My Startup.cs I have

services.AddSaml();
services.AddScoped();


(In the MySaml2ConfigResolver I have both GetLocalServiceProviderConfigurationAsync and GetPartnerIdentityProviderConfigurationAsync)

In my metadata controller I then pull in the IConfigurationToMetadata via DI (and set to _metadataConfig)

Unfortunately when I call

var exportedMetadata = await _metadataConfig.ExportAsync(clientId.ToString());

I get...

[quote]ComponentSpace.Saml2.Exceptions.SamlException: A local identity or service provider name is required for the SAML entity ID.[/quote]

However the GetLocalServiceProviderConfigurationAsync is never called.

Is ISamlConfigurationResolver.IsLocalServiceProviderAsync being called?
This method is called prior to calling ISamlConfigurationResolver.GetLocalServiceProviderConfigurationAsync.
IsLocalServiceProviderAsync must return true for us to call GetLocalServiceProviderConfigurationAsync.

[quote]
ComponentSpace - 11/20/2019
Is ISamlConfigurationResolver.IsLocalServiceProviderAsync being called?
This method is called prior to calling ISamlConfigurationResolver.GetLocalServiceProviderConfigurationAsync.
IsLocalServiceProviderAsync must return true for us to call GetLocalServiceProviderConfigurationAsync.
[/quote]

That was it!

Thanks :)

You’re welcome.