erlef / oidcc

OpenId Connect client library in Erlang & Elixir
https://hexdocs.pm/oidcc
Apache License 2.0
166 stars 44 forks source link

Use case with customer-configured providers #341

Closed AndrewDryga closed 5 months ago

AndrewDryga commented 5 months ago

Hello guys,

We build a product where customers can configure their OIDC connections themselves and I wanted to ask you if you cover such a use case. The challenge is that we can have tens of thousands of OIDC configs (and growing), and we can't really start a GenServer for each one of them, while the API of oidcc looks like it takes provider_configuration_name which is basically a process name.

Right now we are using https://github.com/firezone/openid_connect (that we fully rewrote to have a limited cache size) and would like to give oidcc a try.

Do you have any ideas if we will be able to use it in a similar manner? Maybe some refs to the docs would help. If not, would you want a PR to make it possible?

maennchen commented 5 months ago

You should be able to manage the configurations yourself as well. To do so, you can create a context and then use it:

The functions in oidcc are only convenience functions and you should be able to call underlying functions with a manually created context.

If you opt in to use this method, you’ll be responsible to manage loading and refreshing the configuration.

Make sure yo implement a refresh_jwks function as well to reload the jwks any time you encounter a new and unknown kid.