Sippet.DigestAuth (Sippet v1.0.8) View Source

Implements the Digest authentication protocol.

Link to this section Summary

Functions

Adds an Authorization or Proxy-Authorization header for a request after receiving a 401 or 407 response. CSeq must be updated after calling this function.

Generates a response containing WWW-Authenticate or Proxy-Authenticate header for an incoming request. Use this function to answer to a request with a 401 or 407 response.

Link to this section Types

Specs

password() :: binary()

Specs

realm() :: binary()

Specs

reason() :: term()

Specs

req_option() :: {:cnonce, binary()} | {:nc, binary()}

Specs

req_options() :: [req_option()]

Specs

resp_option() :: {:nonce, binary()} | {:opaque, binary()}

Specs

resp_options() :: [resp_option()]

Specs

username() :: binary()

Link to this section Functions

Link to this function

make_request(outgoing_request, incoming_response, authenticate, options \\ [])

View Source

Specs

make_request(
  outgoing_request :: Sippet.Message.request(),
  incoming_response :: Sippet.Message.response(),
  (realm() -> {:ok, username(), password()} | {:error, reason()}),
  req_options()
) :: {:ok, Sippet.Message.request()} | {:error, reason()}

Adds an Authorization or Proxy-Authorization header for a request after receiving a 401 or 407 response. CSeq must be updated after calling this function.

incoming_response must be an incoming 401/407 response containing a single challenge header (either Proxy-Authenticate or WWW-Authenticate) and outgoing_request is the last request sent to the server. The passed function receives the realm and should return {:ok, username, password} or {:error, reason}.

Link to this function

make_response(incoming_request, status, realm, options \\ [])

View Source

Specs

make_response(
  incoming_request :: Sippet.Message.request(),
  status :: 401 | 407,
  realm(),
  resp_options()
) :: {:ok, Sippet.Message.response()}

Generates a response containing WWW-Authenticate or Proxy-Authenticate header for an incoming request. Use this function to answer to a request with a 401 or 407 response.

A new nonce' will be generated to be used by the client in its response, but will expire after the time configured indicated innonce_timeout'.