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

Types

See t:oidcc_provider_configuration_worker.opts/0

Functions

Get Parsed Jwks

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

Link to this function

child_spec(opts)

View Source (since 3.0.0)
@spec child_spec(opts :: opts()) :: Supervisor.child_spec()
Link to this function

get_jwks(name)

View Source (since 3.0.0)
@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)
Link to this function

get_provider_configuration(name)

View Source (since 3.0.0)
@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)
Link to this function

refresh_configuration(name)

View Source (since 3.0.0)
@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)
Link to this function

refresh_jwks(name)

View Source (since 3.0.0)
@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)
Link to this function

refresh_jwks_for_unknown_kid(name, kid)

View Source (since 3.0.0)
@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")
Link to this function

start_link(opts)

View Source (since 3.0.0)
@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
...> })