View Source AppIdentity.Plug.Config (AppIdentity for Elixir v1.3.0)

AppIdentity.Plug configuration struct builder and telemetry transformer.

Summary

Types

The internal representation of a callback function.

A callback for either on_success or on_resolution which accepts and optionally transforms the request conn.

A callback for on_failure configuration. It must return a normal on_failure value.

AppIdentity.Plug configuration options prior to validation.

t()

Normalized Configuration for AppIdentity.Plug.

Functions

Create and validate the configuration struct from input parameters.

Returns the plug configuration as data for Telemetry context consumption.

Types

@type callback(t) :: {:fn, t}

The internal representation of a callback function.

@type conn_callback() ::
  (Plug.Conn.t() -> Plug.Conn.t()) | {module(), function :: atom()}

A callback for either on_success or on_resolution which accepts and optionally transforms the request conn.

@type on_failure() ::
  :forbidden
  | :continue
  | {:halt, Plug.Conn.status()}
  | {:halt, Plug.Conn.status(), Plug.Conn.body()}
@type on_failure_callback() ::
  (Plug.Conn.t() -> on_failure()) | {module(), function :: atom()}

A callback for on_failure configuration. It must return a normal on_failure value.

@type param() ::
  AppIdentity.disallowed()
  | {:headers, [String.t()]}
  | {:header_groups, %{required(binary()) => [String.t()]}}
  | {:apps, [AppIdentity.App.input() | AppIdentity.App.t()]}
  | {:finder, AppIdentity.App.finder()}
  | {:name, atom()}
  | {:on_failure, on_failure() | on_failure_callback()}
  | {:on_success, conn_callback()}
  | {:on_resolution, conn_callback()}

AppIdentity.Plug configuration options prior to validation.

@type t() :: %AppIdentity.Plug.Config{
  apps: %{optional(AppIdentity.id()) => AppIdentity.App.t()},
  disallowed: [AppIdentity.version()],
  finder:
    nil | {:fn, AppIdentity.App.finder() | {module(), function :: atom()}},
  header_groups: nil | %{required(binary()) => String.t()},
  headers: nil | [String.t()],
  name: atom(),
  on_failure: on_failure() | callback(on_failure_callback()),
  on_resolution: nil | callback(conn_callback()),
  on_success: nil | callback(conn_callback())
}

Normalized Configuration for AppIdentity.Plug.

Functions

@spec new!([param()]) :: t()

Create and validate the configuration struct from input parameters.

Link to this function

telemetry_context(config)

View Source
@spec telemetry_context(t()) :: map()

Returns the plug configuration as data for Telemetry context consumption.