View Source Sippet.DigestAuth (Sippet v1.0.16)

Implements the Digest authentication protocol.

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.

Types

@type password() :: binary()
@type realm() :: binary()
@type reason() :: term()
@type req_option() :: {:cnonce, binary()} | {:nc, binary()}
@type req_options() :: [req_option()]
@type resp_option() :: {:nonce, binary()} | {:opaque, binary()}
@type resp_options() :: [resp_option()]
@type username() :: binary()

Functions

Link to this function

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

View Source
@spec 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
@spec 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'.