OCI.Auth.Adapter behaviour (oci v0.0.5)

View Source

Adapter for authenticating requests to the OCI registry.

Summary

Types

Represents the authorization header value. This is the full authorization header value, including the scheme and credentials.

Represents encoded credentials string. For Basic auth, this is the base64 encoded username:password string. For Bearer auth, this is the encoded token string.

Represents decoded credentials string. For Basic auth, this is the raw username:password string. For Bearer auth, this is the decoded token string.

Represents the authentication scheme type. Currently supports "Basic" and "Bearer" authentication methods.

The subject to set on the request context to be used for authorization.

t()

Types

authorization_t()

@type authorization_t() :: String.t()

Represents the authorization header value. This is the full authorization header value, including the scheme and credentials.

credentials_enc_t()

@type credentials_enc_t() :: String.t()

Represents encoded credentials string. For Basic auth, this is the base64 encoded username:password string. For Bearer auth, this is the encoded token string.

credentials_t()

@type credentials_t() :: String.t()

Represents decoded credentials string. For Basic auth, this is the raw username:password string. For Bearer auth, this is the decoded token string.

error_details_t()

@type error_details_t() :: any()

scheme_t()

@type scheme_t() :: String.t()

Represents the authentication scheme type. Currently supports "Basic" and "Bearer" authentication methods.

subject_t()

@type subject_t() :: any()

The subject to set on the request context to be used for authorization.

Available in: conn.assigns[:oci_ctx]

t()

@type t() :: struct()

Callbacks

authenticate(auth_strategy, authorization)

@callback authenticate(auth_strategy :: t(), authorization :: authorization_t()) ::
  {:ok, subject :: subject_t()}
  | {:error, error_type :: atom(), details :: error_details_t()}

authorize(auth_strategy, context)

@callback authorize(
  auth_strategy :: t(),
  context :: OCI.Context.t()
) :: :ok | {:error, error_type :: atom(), details :: error_details_t()}

challenge(registry)

@callback challenge(registry :: OCI.Registry.t()) :: {String.t(), String.t()}

init(config)

@callback init(config :: map()) :: {:ok, t()} | {:error, term()}