Credentials
is one RFC 7235 §2.1 credentials or challenge: an
authentication scheme followed by either a token68 (token, e.g. the base64
blob of a Basic credential) or a list of auth-params. Both productions have
the same grammar, so this one type models the Authorization and the
WWW-Authenticate side alike.
scheme is kept as written and compared case-insensitively. Param names are
lower-cased and their values unquoted; params holds them in header order.
delete
(Fn [Credentials] ())
deletes a Credentials. Should usually not be called manually.
init
(Fn [String, String, (Array (Pair String String))] Credentials)
creates a Credentials.
param
(Fn [(Ref Credentials a), (Ref String b)] (Maybe String))
(param c name)
looks up auth-param name (case-insensitive), returning
(Maybe String).
params
(Fn [(Ref Credentials a)] (Ref (Array (Pair String String)) a))
gets the params property of a Credentials.
realm
(Fn [(Ref Credentials a)] (Maybe String))
(realm c)
the realm auth-param, as (Maybe String).
scheme
(Fn [(Ref Credentials a)] (Ref String a))
gets the scheme property of a Credentials.
scheme-is?
(Fn [(Ref Credentials a), (Ref String b)] Bool)
(scheme-is? c name)
whether the scheme is name, compared case-insensitively as
RFC 7235 §2.1 requires.
set-params
(Fn [Credentials, (Array (Pair String String))] Credentials)
sets the params property of a Credentials.
set-params!
(Fn [(Ref Credentials a), (Array (Pair String String))] ())
sets the params property of a Credentials in place.
set-scheme
(Fn [Credentials, String] Credentials)
sets the scheme property of a Credentials.
set-scheme!
(Fn [(Ref Credentials a), String] ())
sets the scheme property of a Credentials in place.
set-token
(Fn [Credentials, String] Credentials)
sets the token property of a Credentials.
set-token!
(Fn [(Ref Credentials a), String] ())
sets the token property of a Credentials in place.
str
(Fn [(Ref Credentials a)] String)
(str c)
serializes back into a header value, which parses back into an equal
Credentials. A token takes precedence over params, since RFC 7235 allows
only one of the two. Param values are always quoted, which the grammar permits
for any of them.
token
(Fn [(Ref Credentials a)] (Ref String a))
gets the token property of a Credentials.
update-params
(Fn [Credentials, (Ref (Fn [(Array (Pair String String))] (Array (Pair String String)) a) b)] Credentials)
updates the params property of a Credentials using a function f.
update-scheme
(Fn [Credentials, (Ref (Fn [String] String a) b)] Credentials)
updates the scheme property of a Credentials using a function f.
update-token
(Fn [Credentials, (Ref (Fn [String] String a) b)] Credentials)
updates the token property of a Credentials using a function f.