UeberauthOidcc.Config (Ueberauth OIDCC v0.4.0-pre.4)

Functions for managing the configuration passed to request/callback modules.

Summary

Types

t()

Configuration taken by the request/callback modules.

Functions

Default options for UeberauthOidcc.

Given a list of configurations (either as maps or keyword lists), merges them together.

Types

@type t() :: %{
  :issuer => atom(),
  :client_id => binary(),
  :client_secret => binary(),
  :redirect_uri => binary(),
  optional(:scopes) => :oidcc_scope.scopes(),
  optional(:session_key) => binary(),
  optional(:authorization_params) => Enumerable.t(),
  optional(:authorization_endpoint) => binary(),
  optional(:token_endpoint) => binary(),
  optional(:userinfo) => boolean(),
  optional(:userinfo_endpoint) => binary(),
  optional(:introspection) => boolean(),
  optional(:introspection_endpoint) => binary(),
  optional(:module) => module(),
  optional(:response_type) => binary(),
  optional(atom()) => term()
}

Configuration taken by the request/callback modules.

Required:

  • issuer: the name of an Oidcc.ProviderConfiguration.Worker to use for configuration
  • client_id: the client ID to use
  • client_secret: the client secret to use
  • redirect_uri: the full URI to redirect back to after authentication

Optional:

  • session_key: area of the Plug session to store data between the request and callback (default: "ueberauth_strategy_oidcc")
  • scopes: list of scopes to request (default: ["openid"])
  • authorization_params: additional parameters to pass in the query to the authorization_endpoint
  • authorization_endpoint: override the authorization_endpoint defined by the issuer
  • token_endpoint: override the token_endpoint defined by the issuer
  • userinfo: whether to request the userinfo endpoint (default: false)
  • userinfo_endpoint: override the userinfo_endpoint defined by the issuer
  • validate_scopes: whether to validate that the returned scopes are a subset of the requested scopes (default: false)

You can also give any options taken by the Oidcc.create_redirect_url/4 or Oidcc.retrieve_token/5 functions.

For testing:

  • module: (default: Oidcc)
  • response_type: (default:"code")

Functions

@spec default() :: map()

Default options for UeberauthOidcc.

Link to this function

merge_and_expand_configuration(configurations)

@spec merge_and_expand_configuration(Enumerable.t()) :: t()

Given a list of configurations (either as maps or keyword lists), merges them together.

This starts with the default options (see default/0), and merges each configuration one at a time, taking the last value.

In addition to bare values (strings, atoms, numbers), some other types are accepted:

  • a 0-arity function
  • {:system, <env var>} which will use the value of the environment variable if it's defined
  • {:system, <env var>, <default>} which will use the value of the environment variable if defined, otherwise the default
  • {mod, fun, args} which will apply the given MFA tuple