UeberauthOidcc.Config (Ueberauth OIDCC v0.3.3)

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

See t/0 for the supported values.

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(:session_cookie) => binary(),
  optional(:session_max_age) => pos_integer(),
  optional(:session_same_site) => binary(),
  optional(:scopes) => :oidcc_scope.scopes(),
  optional(:authorization_params) => Enumerable.t(),
  optional(:authorization_params_passthrough) => Enumerable.t(),
  optional(:authorization_endpoint) => binary(),
  optional(:token_endpoint) => binary(),
  optional(:userinfo) => boolean(),
  optional(:userinfo_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_cookie: name of cookie used store data between the request and callback (default: "_ueberauth_strategy_oidcc")
  • session_key: secret name to use with Plug.Crypto.encrypt/4 (default: "ueberauth_strategy_oidcc")
  • session_max_age: maximum number of seconds allowed between the request and callback (default: 3600)
  • session_same_site: SameSite value to use for the session cookie (default: "Lax")
  • scopes: list of scopes to request (default: ["openid"])
  • authorization_params: map of additional parameters to pass in the query to the authorization_endpoint
  • authorization_params_passthrough: list of params which can be passed through from the initial request
  • 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)

The session_cookie name will also be prefixed with __Secure- if the request comes over HTTPS to ensure that browsers only send it securely.

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