ExScimClient.Client (ex_scim_client v0.3.0)

Copy Markdown View Source

Client configuration struct.

Authentication is configurable via the auth field.

new/2 accepts either a bearer token string or an auth strategy tuple/atom:

  • {:bearer, token} - Authorization: Bearer <token>
  • {:basic, username, password} - Authorization: Basic <base64>
  • {:header, name, value} - an arbitrary authorization header
  • :none - no authorization header

Examples

iex> client = ExScimClient.Client.new("https://example.com/scim/v2", "token123")
iex> client.base_url
"https://example.com/scim/v2"
iex> client.bearer
"token123"

iex> client = ExScimClient.Client.new("https://example.com/scim/v2", {:basic, "user", "pass"})
iex> client.auth
{:basic, "user", "pass"}

Summary

Functions

Creates a new client configuration.

Types

auth()

@type auth() ::
  {:bearer, String.t()}
  | {:basic, String.t(), String.t()}
  | {:header, String.t(), String.t()}
  | :none

t()

@type t() :: %ExScimClient.Client{
  auth: auth() | nil,
  base_url: String.t(),
  bearer: String.t() | nil,
  default_headers: [{String.t(), String.t()}]
}

Functions

new(base_url, bearer)

@spec new(String.t(), String.t() | auth()) :: t()

Creates a new client configuration.

Parameters

  • base_url - Provider base URL
  • auth - a bearer token string, or an auth strategy ({:bearer, token}, {:basic, username, password}, {:header, name, value}, :none)

Examples

iex> client = ExScimClient.Client.new("https://example.com/scim/v2", "abc123")
iex> %ExScimClient.Client{base_url: "https://example.com/scim/v2", bearer: "abc123"} = client

iex> client = ExScimClient.Client.new("https://example.com/scim/v2", {:bearer, "abc123"})
iex> client.auth
{:bearer, "abc123"}