Up

module Auth

: sig

HTTP Authentication and Authorization header parsing and generation

#
type challenge = [
| `Basic of string
]

HTTP authentication challenge types

#
type credential = [
| `Basic of string * string
| `Other of string
]

HTTP authorization credential types

#
val string_of_credential : credential -> string

string_of_credential converts the credential to a string compatible with the HTTP/1.1 wire format for authorization credentials ("responses")

#
val credential_of_string : string -> credential

credential_of_string cred_s converts an HTTP response to an authentication challenge into a credential. If the credential is not recognized, `Other cred_s is returned.

#
val string_of_challenge : challenge -> string

string_of_challenge challenge converts the challenge to a string compatible with the HTTP/1.1 wire format for authentication challenges.

For example, a `Basic challenge with realm "foo" will be marshalled to "Basic realm=foo", which can then be combined with a www-authenticate HTTP header and sent back to the client. There is a helper function Header.add_authorization_req that does just this.

#
val challenge_of_sexp : Sexplib.Sexp.t -> challenge
#
val __challenge_of_sexp__ : Sexplib.Sexp.t -> challenge
#
val sexp_of_challenge : challenge -> Sexplib.Sexp.t
#
val credential_of_sexp : Sexplib.Sexp.t -> credential
#
val __credential_of_sexp__ : Sexplib.Sexp.t -> credential
#
val sexp_of_credential : credential -> Sexplib.Sexp.t
end