View Source Oidcc.ProviderConfiguration.Worker (Oidcc v3.2.6)
OIDC Config Provider Worker
Loads and continuously refreshes the OIDC configuration and JWKs
Usage in Supervisor
Supervisor.init([
{Oidcc.ProviderConfiguration.Worker, %{issuer: "https://accounts.google.com"}}
], strategy: :one_for_one)
Summary
Functions
Get Parsed Jwks
Get Configuration
Refresh Configuration
Refresh JWKs
Refresh JWKs if the provided Kid
is not matching any currently loaded keys
Start Configuration Worker
Types
@type opts() :: %{ optional(:name) => GenServer.name(), :issuer => :uri_string.uri_string(), optional(:provider_configuration_opts) => :oidcc_provider_configuration.opts(), optional(:backoff_min) => :oidcc_backoff.min(), optional(:backoff_max) => :oidcc_backoff.max(), optional(:backoff_type) => :oidcc_backoff.type() }
See t:oidcc_provider_configuration_worker.opts/0
Functions
@spec child_spec(opts :: opts()) :: Supervisor.child_spec()
@spec get_jwks(name :: GenServer.name()) :: JOSE.JWK.t()
Get Parsed Jwks
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com"
...> })
...> %JOSE.JWK{} =
...> Oidcc.ProviderConfiguration.Worker.get_jwks(pid)
@spec get_provider_configuration(name :: GenServer.name()) :: Oidcc.ProviderConfiguration.t()
Get Configuration
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com"
...> })
...> %Oidcc.ProviderConfiguration{issuer: "https://accounts.google.com"} =
...> Oidcc.ProviderConfiguration.Worker.get_provider_configuration(pid)
@spec refresh_configuration(name :: GenServer.name()) :: :ok
Refresh Configuration
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com"
...> })
...> :ok = Oidcc.ProviderConfiguration.Worker.refresh_configuration(pid)
@spec refresh_jwks(name :: GenServer.name()) :: :ok
Refresh JWKs
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com"
...> })
...> :ok = Oidcc.ProviderConfiguration.Worker.refresh_jwks(pid)
@spec refresh_jwks_for_unknown_kid(name :: GenServer.name(), kid :: String.t()) :: :ok
Refresh JWKs if the provided Kid
is not matching any currently loaded keys
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com"
...> })
...> :ok = Oidcc.ProviderConfiguration.Worker.refresh_jwks_for_unknown_kid(pid, "kid")
@spec start_link(opts :: opts()) :: GenServer.on_start()
Start Configuration Worker
Examples
iex> {:ok, _pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com",
...> name: __MODULE__.GoogleConfigProvider
...> })