View Source Oidcc.ClientContext (Oidcc v3.0.0-rc.2)
Client Configuration for authorization, token exchange and userinfo
For most projects, it makes sense to use
Oidcc.ProviderConfiguration.Worker
and the high-level
interface of Oidcc
. In that case direct usage of this
module is not needed.
Link to this section Summary
Functions
Create Client Context from a Oidcc.ProviderConfiguration.Worker
Create Client Context manually
Link to this section Types
@type t() :: %Oidcc.ClientContext{ client_id: String.t(), client_secret: String.t(), jwks: JOSE.JWK.t(), provider_configuration: Oidcc.ProviderConfiguration.t() }
Link to this section Functions
Link to this function
from_configuration_worker(provider_name, client_id, client_secret)
View Source (since 3.0.0)@spec from_configuration_worker( provider_name :: GenServer.name(), client_id :: String.t(), client_secret :: String.t() ) :: {:ok, t()} | {:error, :oidcc_client_context.t()}
Create Client Context from a Oidcc.ProviderConfiguration.Worker
examples
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://accounts.google.com",
...> name: __MODULE__.GoogleConfigProvider
...> })
...>
...> {:ok, %Oidcc.ClientContext{}} =
...> Oidcc.ClientContext.from_configuration_worker(
...> __MODULE__.GoogleConfigProvider,
...> "client_id",
...> "client_Secret"
...> )
...>
...> {:ok, %Oidcc.ClientContext{}} =
...> Oidcc.ClientContext.from_configuration_worker(
...> pid,
...> "client_id",
...> "client_Secret"
...> )
Link to this function
from_manual(configuration, jwks, client_id, client_secret)
View Source (since 3.0.0)@spec from_manual( configuration :: Oidcc.ProviderConfiguration.t(), jwks :: JOSE.JWK.t(), client_id :: String.t(), client_secret :: String.t() ) :: t()
Create Client Context manually
examples
Examples
iex> {:ok, {configuration, _expiry}} =
...> Oidcc.ProviderConfiguration.load_configuration(
...> "https://login.salesforce.com"
...> )
...>
...> {:ok, {jwks, _expiry}} =
...> Oidcc.ProviderConfiguration.load_jwks(
...> configuration.jwks_uri
...> )
...>
...> %Oidcc.ClientContext{} =
...> Oidcc.ClientContext.from_manual(
...> configuration,
...> jwks,
...> "client_id",
...> "client_Secret"
...> )