View Source oidcc_provider_configuration_worker (Oidcc v3.0.0-alpha.4)
OIDC Config Provider Worker
Loads and continuously refreshes the OIDC configuration and JWKsLink to this section 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 Provider
Link to this section Types
-type opts() :: #{name => gen_server:server_name(), issuer := uri_string:uri_string(), provider_configuration_opts => oidcc_provider_configuration:opts()}.
Link to this section Functions
-spec get_jwks(Name :: gen_server:server_ref()) -> jose_jwk:key().
-spec get_provider_configuration(Name :: gen_server:server_ref()) -> oidcc_provider_configuration:t().
-spec refresh_configuration(Name :: gen_server:server_ref()) -> ok.
Refresh Configuration
examples
Examples
{ok, Pid} =
oidcc_provider_configuration_worker:start_link(#{
issuer => <<"https://accounts.google.com">>
}).
%% Later
oidcc_provider_configuration_worker:refresh_configuration(Pid).
-spec refresh_jwks(Name :: gen_server:server_ref()) -> ok.
Refresh JWKs
examples
Examples
{ok, Pid} =
oidcc_provider_configuration_worker:start_link(#{
issuer => <<"https://accounts.google.com">>
}).
%% Later
oidcc_provider_configuration_worker:refresh_jwks(Pid).
-spec refresh_jwks_for_unknown_kid(Name :: gen_server:server_ref(), Kid :: binary()) -> ok.
Refresh JWKs if the provided Kid
is not matching any currently loaded keys
examples
Examples
{ok, Pid} =
oidcc_provider_configuration_worker:start_link(#{
issuer => <<"https://accounts.google.com">>
}).
oidcc_provider_configuration_worker:refresh_jwks_for_unknown_kid(Pid, <<"kid">>).
-spec start_link(Opts :: opts()) -> gen_server:start_ret().
Start Configuration Provider
examples
Examples
{ok, Pid} =
oidcc_provider_configuration_worker:start_link(#{
issuer => <<"https://accounts.google.com">>,
name => {local, google_config_provider}
}).
%% ...
-behaviour(supervisor).
%% ...
init(_opts) ->
SupFlags = #{strategy => one_for_one, intensity => 1, period => 5},
ChildSpecs = [#{id => google_config_provider,
start => {oidcc_provider_configuration_worker,
start_link,
[
#{issuer => <<"https://accounts.google.com">>}
]},
restart => permanent,
type => worker,
modules => [oidcc_provider_configuration_worker]}],
{ok, {SupFlags, ChildSpecs}}.