Attempting to integrate with kanidm (https://kanidm.com) as an OIDC provider, I am unable to successfully start the provider configuration worker, as it crashes with {:error, :badarg}.
Even setting a fallback expiry does not help, as the max-age=0 at the end of the header ensures the fallback is not honored. It sets true on max-age and then skips the 0.
Current behavior
iex(6)> Oidcc.ProviderConfiguration.Worker.start_link(%{issuer: "https://id.robins.wtf/oauth2/openid/temp"})
{:ok, #PID<0.847.0>}
[error] GenServer Sower.Provider terminating
** (MatchError) no match of right hand side value: {:error, :badarg}
(oidcc 3.2.0) src/oidcc_provider_configuration_worker.erl:185: :oidcc_provider_configuration_worker.handle_continue/2
(stdlib 6.0) gen_server.erl:2163: :gen_server.try_handle_continue/3
(stdlib 6.0) gen_server.erl:2072: :gen_server.loop/7
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:continue, :load_configuration}
How to reproduce
See current behavior.
Expected behavior
I expect the worker process to successfully initialize.
This error wasn't clear at all and required a bit of digging, so if possible it would be nice to expose a more helpful error.
oidcc version
3.2.0
Erlang version
27.0
Elixir version
1.17.2
Summary
Attempting to integrate with kanidm (https://kanidm.com) as an OIDC provider, I am unable to successfully start the provider configuration worker, as it crashes with
{:error, :badarg}
.I have an instance publicly available at: https://id.robins.wtf/oauth2/openid/temp
After troubleshooting, I tracked it down to an issue with the parsing of the
cache-control
header. Kanidm setscache-control: no-store, no-cache, max-age=0
in its responses, which returnstrue
from the foldl here: https://github.com/erlef/oidcc/blob/299114248949c8c83d5a853f1340991733c763c0/src/oidcc_provider_configuration.erl#L589-L603Even setting a fallback expiry does not help, as the
max-age=0
at the end of the header ensures the fallback is not honored. It sets true on max-age and then skips the 0.Current behavior
How to reproduce
See current behavior.
Expected behavior
I expect the worker process to successfully initialize.
This error wasn't clear at all and required a bit of digging, so if possible it would be nice to expose a more helpful error.