Liking cljdoc? Tell your friends :D

toolnexus.mcp-auth


answer-callbackclj/s

(answer-callback answer)

The callback URL out of a §10 Answer's data (callbackUrl, any key spelling).

The callback URL out of a §10 Answer's data (`callbackUrl`, any key spelling).
sourceraw docstring

answer-denied-textclj/s

(answer-denied-text answer)

SPEC §2A.1a — the error for a not-ok answer to an authorization request.

SPEC §2A.1a — the error for a not-ok answer to an authorization request.
sourceraw docstring

b64urlclj/s

(b64url x)

base64url without padding (RFC 4648 §5) of byte values or a string.

base64url without padding (RFC 4648 §5) of byte values or a string.
sourceraw docstring

bearerclj/s

(bearer e resource)

The access token to send to resource (refreshed if expired), or nil = send none. A token is sent only once this server's issuer is confirmed (§2A.1.11). Refresh is single-flight: N concurrent callers share one refresh request.

The access token to send to `resource` (refreshed if expired), or nil = send
none. A token is sent only once this server's issuer is confirmed (§2A.1.11).
Refresh is single-flight: N concurrent callers share one refresh request.
sourceraw docstring

challenge!clj/s

(challenge! e resource status www sent)

Handle a 401/403 from resource. sent is the access token the failed request carried (nil = none). Returns :retry (send the request again now) or {:pending request} (pause mode — a §10 authorization Request; finish with resume!). Throws ex-info carrying a safe message on any failure.

Handle a 401/403 from `resource`. `sent` is the access token the failed
request carried (nil = none). Returns `:retry` (send the request again now)
or `{:pending request}` (pause mode — a §10 `authorization` Request; finish
with `resume!`). Throws ex-info carrying a safe message on any failure.
sourceraw docstring

complete!clj/s

(complete! e f callback-url)

Validate the callback (iss, then state, then error — SPEC §2A.1 step 6) and exchange the code. Nothing is stored on failure.

Validate the callback (iss, then state, then error — SPEC §2A.1 step 6) and
exchange the code. Nothing is stored on failure.
sourceraw docstring

default-open-urlclj/s

(default-open-url url)

Open url in the system browser (macOS open, else xdg-open, else Windows start).

Open `url` in the system browser (macOS `open`, else `xdg-open`, else Windows `start`).
sourceraw docstring

discover-asclj/s

(discover-as e issuer)

RFC 8414 then OIDC metadata, in SPEC §2A.1 step 3's order; issuer must match.

RFC 8414 then OIDC metadata, in SPEC §2A.1 step 3's order; issuer must match.
sourceraw docstring

engineclj/s

(engine cfg {:keys [token-store open-url http]})

One auth engine per remote server. cfg is the mcp.json auth object (camelCase keys, keywords or strings); opts are the load options :token-store and :open-url, plus :http (a request fn, tests only).

One auth engine per remote server. `cfg` is the mcp.json `auth` object
(camelCase keys, keywords or strings); `opts` are the load options
`:token-store` and `:open-url`, plus `:http` (a request fn, tests only).
sourceraw docstring

form-encodeclj/s

(form-encode m)

application/x-www-form-urlencoded, keys in sorted order (deterministic).

application/x-www-form-urlencoded, keys in sorted order (deterministic).
sourceraw docstring

hexclj/s

(hex vs)

Lower-case hex of unsigned byte values.

Lower-case hex of unsigned byte values.
sourceraw docstring

memory-storeclj/s

(memory-store)

The default token store: in-memory, per load. A store is a map of three fns {:load (fn [resource]) :save (fn [resource token]) :delete (fn [resource])}.

The default token store: in-memory, per load. A store is a map of three fns
`{:load (fn [resource]) :save (fn [resource token]) :delete (fn [resource])}`.
sourceraw docstring

modeclj/s

(mode e)

"auto" unless the config says "pause".

"auto" unless the config says "pause".
sourceraw docstring

parse-challengeclj/s

(parse-challenge h)

Bearer k="v", k2=v2 (RFC 6750 §3) as {lower-key value}.

`Bearer k="v", k2=v2` (RFC 6750 §3) as {lower-key value}.
sourceraw docstring

parse-queryclj/s

(parse-query q)

A query/form string as {name first-value}.

A query/form string as {name first-value}.
sourceraw docstring

parse-urlclj/s

(parse-url u)

{:scheme :host (with port) :hostname :path :query} of an absolute URL, or nil.

{:scheme :host (with port) :hostname :path :query} of an absolute URL, or nil.
sourceraw docstring

rand-strclj/s

(rand-str n)

n url-safe random characters from the host CSPRNG (via random-uuid).

n url-safe random characters from the host CSPRNG (via random-uuid).
sourceraw docstring

resume!clj/s

(resume! e id callback-url)

Finish a paused authorization with the callback URL the AS redirected to. The caller then sends the paused request (for the first time).

Finish a paused authorization with the callback URL the AS redirected to.
The caller then sends the paused request (for the first time).
sourceraw docstring

revealclj/s

(reveal x)

The value of a Token secret (:access-token / :refresh-token), or nil.

The value of a Token secret (`:access-token` / `:refresh-token`), or nil.
sourceraw docstring

sha256clj/s

(sha256 x)

SHA-256 of a string (UTF-8) or a seq of unsigned byte values; returns 32 unsigned byte values. FIPS 180-4, plain arithmetic, identical on both hosts.

SHA-256 of a string (UTF-8) or a seq of unsigned byte values; returns 32
unsigned byte values. FIPS 180-4, plain arithmetic, identical on both hosts.
sourceraw docstring

tokenclj/s

(token {:keys [access-token refresh-token expires-at scopes issuer client-id
               resource]})

A Token: {:access-token :refresh-token :expires-at :scopes :issuer :client-id :resource}. The two token values are held in closures, so the Token's printed form never shows them; read them with reveal.

A Token: `{:access-token :refresh-token :expires-at :scopes :issuer :client-id
:resource}`. The two token values are held in closures, so the Token's printed
form never shows them; read them with `reveal`.
sourceraw docstring

token->dataclj/s

(token->data t)

A Token as plain data (secrets revealed) — for a store that persists it. Persist it confidentially.

A Token as plain data (secrets revealed) — for a store that persists it.
Persist it confidentially.
sourceraw docstring

url-decodeclj/s

(url-decode s)
(url-decode s plus?)

Percent-decode ONCE (and + as space, for forms). Throws on a malformed escape.

Percent-decode ONCE (and `+` as space, for forms). Throws on a malformed escape.
sourceraw docstring

url-encodeclj/s

(url-encode s)

Percent-encode every byte outside RFC 3986's unreserved set (UTF-8).

Percent-encode every byte outside RFC 3986's unreserved set (UTF-8).
sourceraw docstring

utf8-valsclj/s

(utf8-vals s)

A string's UTF-8 bytes as unsigned values (0-255). Through koine's base64, which is the one portable string<->bytes seam both hosts already share.

A string's UTF-8 bytes as unsigned values (0-255). Through koine's base64,
which is the one portable string<->bytes seam both hosts already share.
sourceraw docstring

vals->utf8clj/s

(vals->utf8 vs)

Unsigned byte values back to a string (UTF-8).

Unsigned byte values back to a string (UTF-8).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close