Git Product home page Git Product logo

Comments (8)

leastprivilege avatar leastprivilege commented on June 2, 2024

This fails

could you be a bit more specific?

from identitymodel.aspnetcore.

rmja avatar rmja commented on June 2, 2024

In my case it fails because I do not have a ConfigurationManger on the OpenIdOptions, and so this line throws NullReferenceException:

configuration = await options.ConfigurationManager.GetConfigurationAsync(default);

I guess the question is. What is the desired behavior when there are multiple configured clients and one of them is called "default". Should that really change the behavior of the default client compared to the case when there is only one client?

from identitymodel.aspnetcore.

leastprivilege avatar leastprivilege commented on June 2, 2024

I am still not 100% clear what the problem is. but the behavior of the default config plumbing allows to have multiple named clients. If you don't pass a name explicitly, it falls bad to a "default" client.

And that's IIRC either the one client (if it is only one) - or the OIDC-based configuration.

Do you think this behavior does not make sense? You are probably aware that you replace the config loading part if you want different behavior.

from identitymodel.aspnetcore.

rmja avatar rmja commented on June 2, 2024

Ok I will try and clarify.

If I have one defined, named client, no matter the name, then the associated request will always be returned from GetClientCredentialsRequestAsync(). For example:

options.Client.Clients.Add("default", defaultRequest)

or

options.Client.Clients.Add("some-other-name", defaultRequest)

If I have multiple defined, named clients, then the name matters. For example:

options.Client.Clients.Add("client-A", requestA); // This returns the requestA from GetClientCredentialsRequestAsync
options.Client.Clients.Add("client-B", requestB); // This returns the requestB from GetClientCredentialsRequestAsync

but, if one of the clients is named exactly "default", then

options.Client.Clients.Add("default", requestA); // This does NOT return the requestA from GetClientCredentialsRequestAsync
options.Client.Clients.Add("some-other", requestB); // This returns the requestB from GetClientCredentialsRequestAsync

The behavior that makes sense to me would be that if a client is added with the explicit name "default" if more than one client is added, then that request should also be the one that is returned by GetClientCredentialsRequestAsync().

Hope it makes sense :)

from identitymodel.aspnetcore.

leastprivilege avatar leastprivilege commented on June 2, 2024

And why don't you use the name in your application code when you have more than one client config?

from identitymodel.aspnetcore.

rmja avatar rmja commented on June 2, 2024

I do. I just happened to explicitly use the name "default". After I renamed it to something else, the code started to work.

from identitymodel.aspnetcore.

leastprivilege avatar leastprivilege commented on June 2, 2024

Ah I see ;)

from identitymodel.aspnetcore.

github-actions avatar github-actions commented on June 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue.

from identitymodel.aspnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.