1

We're using Sustainsys.Saml2 in our multi-tenant MVC 5 application. It's working fine for a single tenant at the moment, but we can't work out how to add additional tenants. The web.config has this...

<sustainsys.saml2 entityId="https://localhost:44305" returnUrl="https://localhost:44305/" publicOrigin="https://localhost:44305">
    <identityProviders>
      <add entityId="https://stubidp.sustainsys.com/Metadata" signOnUrl="https://stubidp.sustainsys.com/" allowUnsolicitedAuthnResponse="true" binding="HttpPost" metadataLocation="~/App_Data/StubidpMetadata.xml" wantAuthnRequestsSigned="true">
        <signingCertificate storeName="AddressBook" storeLocation="LocalMachine" findValue="ABC123" x509FindType="FindBySerialNumber" />
      </add>
    </identityProviders>
  </sustainsys.saml2>

... and in the Saml2Controller.cs we have the following...

        public static IOptions Options {
            get {
                if (options == null)
                {
                    options = Sustainsys.Saml2.Configuration.Options.FromConfiguration;
                }
                return options;
            }
            set {
                options = value;
            }
        }

        public ActionResult SignIn()
        {
            var result = CommandFactory.GetCommand(CommandFactory.SignInCommandName).Run(
                Request.ToHttpRequestData(),
                Options);
            if (result.HandledResult)
            {
                throw new NotSupportedException("The MVC controller doesn't support setting CommandResult.HandledResult.");
            }            
            result.ApplyCookies(Response, Options.Notifications.EmitSameSiteNone(Request.UserAgent));
            return result.ToActionResult();
        }

I know we can add multiple sets of identityProviders config to the sustainsys.saml2/identityProviders collection in web.config, but how can we retrieve the particular one we're looking for inside the SignIn action?

Secondary question: inside the SignIn action we would also like to set some arbitrary data which we can subsequently retrieve in the Acs action. We tried setting RelayData but result.RelayData ends up null in the Acs action.

            result.RelayData = new Dictionary<string, string> { { "ABC", "123" } };
centralscru
  • 6,580
  • 3
  • 32
  • 43

0 Answers0