4

I have a C# project using MVC and OWIN.

I am trying to allow the use of multiple OpenID providers. I've seen how people do it by passing the parameter string in using "RedirectToIdentityProvider" in the pipeline like in this article: https://www.scottbrady91.com/Identity-Server/Identity-Server-3-Standalone-Implementation-Part-2

I am, however, not using any of the big name providers like google or github. I'm making it applicable to any Id Provider that supports OIDC.

The problem is I want to set the Authority dynamically in the RedirectToIdentityProvider Task...but I don't know how.

        private async Task OnRedirectToIdentityProvider(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
    {
        var openIdProviderService = new OpenIdProviderService();
        var openIdProvider = openIdProviderService.Get("SecureAuthA");

        notification.ProtocolMessage.ClientId = openIdProvider.ClientId;//"3b11fd9d1d6f454c8ed09b837ed632cb";
        notification.ProtocolMessage.ClientSecret = openIdProvider.ClientSecret;//"6e687e0f551fe32ea7df63a553f73a2206b8c69e0da436efb5191c229528bef4";

Is there a way to set the Authority dynamically?

TheFootClan
  • 165
  • 1
  • 3
  • 12
  • Can you give some more details? As far as I understood, you want to have more than one OIDC providers, that are accessed from your IdentityServer. Am I right? – m3n7alsnak3 Feb 23 '18 at 22:10
  • That is correct. – TheFootClan Feb 23 '18 at 23:37
  • And can you describe what exactly workflow do you expect - a user tries to login in a client, and the identity server login page, with the bunch of options (OIDC providers) is shown to him, he selects, logs in with the provider and voila? – m3n7alsnak3 Feb 23 '18 at 23:47
  • I have a webpage where a third party can reach. This webpage will extract querystring parameters. http://test.com?provider=providerA. This webpage takes the provider indicated and will set the clientid and clientsecret and authorization endpoint based on this provider. It will then send a request to the correct provider indicated. – TheFootClan Feb 24 '18 at 00:09
  • 1
    We had this requirement and I ended up forking the OIDC middleware to make it possible to pass in additional settings when calling Challenge(). – mackie Feb 24 '18 at 08:33
  • 1
    Is there sample code or something that you could refer me to online? That sounds like what I have to do. – TheFootClan Feb 24 '18 at 19:16

0 Answers0