View Source Boruta.BasicAuth (Boruta core v2.3.4)

HTTP BasicAuth utilities

Provide utilities to decode Basic authorization header as stated in RFC 7617 - The 'Basic' HTTP Authentication Scheme

Summary

Functions

Decode given authorization header and returns an array containing username and password.

Functions

@spec decode(authorization_header :: String.t()) ::
  {:ok, [String.t()]} | {:error, String.t()}

Decode given authorization header and returns an array containing username and password.

Examples

iex> Boruta.BasicAuth.decode("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")
{:ok, ["username", "password"]}

iex> Boruta.BasicAuth.decode("bad_authorization_header")
{:error, "`bad_authorization_header` is not a valid Basic authorization header."}