ocaml-opentelemetry/cohttp/Cohttp/Auth/index.html
2025-03-27 13:35:42 +00:00

2 lines
7.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Auth (cohttp.Cohttp.Auth)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.0.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../index.html">Index</a> &#x00BB; <a href="../../index.html">cohttp</a> &#x00BB; <a href="../index.html">Cohttp</a> &#x00BB; Auth</nav><header class="odoc-preamble"><h1>Module <code><span>Cohttp.Auth</span></code></h1><p>HTTP Authentication and Authorization header parsing and generation</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-challenge"><a href="#type-challenge" class="anchor"></a><code><span><span class="keyword">type</span> challenge</span><span> = </span><span>[ </span></code><ol><li id="type-challenge.Basic" class="def variant constructor anchored"><a href="#type-challenge.Basic" class="anchor"></a><code><span>| </span><span>`Basic <span class="keyword">of</span> string</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Basic authentication within a realm</p><span class="comment-delim">*)</span></div></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>HTTP authentication challenge types</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-sexp_of_challenge"><a href="#val-sexp_of_challenge" class="anchor"></a><code><span><span class="keyword">val</span> sexp_of_challenge : <span><a href="#type-challenge">challenge</a> <span class="arrow">&#45;&gt;</span></span> <a href="../../../sexplib0/Sexplib0/Sexp/index.html#type-t">Sexplib0.Sexp.t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-challenge_of_sexp"><a href="#val-challenge_of_sexp" class="anchor"></a><code><span><span class="keyword">val</span> challenge_of_sexp : <span><a href="../../../sexplib0/Sexplib0/Sexp/index.html#type-t">Sexplib0.Sexp.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-challenge">challenge</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-__challenge_of_sexp__"><a href="#val-__challenge_of_sexp__" class="anchor"></a><code><span><span class="keyword">val</span> __challenge_of_sexp__ : <span><a href="../../../sexplib0/Sexplib0/Sexp/index.html#type-t">Sexplib0.Sexp.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-challenge">challenge</a></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-credential"><a href="#type-credential" class="anchor"></a><code><span><span class="keyword">type</span> credential</span><span> = </span><span>[ </span></code><ol><li id="type-credential.Basic" class="def variant constructor anchored"><a href="#type-credential.Basic" class="anchor"></a><code><span>| </span><span>`Basic <span class="keyword">of</span> string * string</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Basic authorization with a username and password</p><span class="comment-delim">*)</span></div></li><li id="type-credential.Other" class="def variant constructor anchored"><a href="#type-credential.Other" class="anchor"></a><code><span>| </span><span>`Other <span class="keyword">of</span> string</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>An unknown credential type that will be passed straight through to the application layer</p><span class="comment-delim">*)</span></div></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>HTTP authorization credential types</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-sexp_of_credential"><a href="#val-sexp_of_credential" class="anchor"></a><code><span><span class="keyword">val</span> sexp_of_credential : <span><a href="#type-credential">credential</a> <span class="arrow">&#45;&gt;</span></span> <a href="../../../sexplib0/Sexplib0/Sexp/index.html#type-t">Sexplib0.Sexp.t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-credential_of_sexp"><a href="#val-credential_of_sexp" class="anchor"></a><code><span><span class="keyword">val</span> credential_of_sexp : <span><a href="../../../sexplib0/Sexplib0/Sexp/index.html#type-t">Sexplib0.Sexp.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-credential">credential</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-__credential_of_sexp__"><a href="#val-__credential_of_sexp__" class="anchor"></a><code><span><span class="keyword">val</span> __credential_of_sexp__ : <span><a href="../../../sexplib0/Sexplib0/Sexp/index.html#type-t">Sexplib0.Sexp.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-credential">credential</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_credential"><a href="#val-string_of_credential" class="anchor"></a><code><span><span class="keyword">val</span> string_of_credential : <span><a href="#type-credential">credential</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p><code>string_of_credential</code> converts the <a href="#type-credential"><code>credential</code></a> to a string compatible with the HTTP/1.1 wire format for authorization credentials (&quot;responses&quot;)</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-credential_of_string"><a href="#val-credential_of_string" class="anchor"></a><code><span><span class="keyword">val</span> credential_of_string : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-credential">credential</a></span></code></div><div class="spec-doc"><p><code>credential_of_string cred_s</code> converts an HTTP response to an authentication challenge into a <a href="#type-credential"><code>credential</code></a>. If the credential is not recognized, <code>`Other cred_s</code> is returned.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_challenge"><a href="#val-string_of_challenge" class="anchor"></a><code><span><span class="keyword">val</span> string_of_challenge : <span><a href="#type-challenge">challenge</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p><code>string_of_challenge challenge</code> converts the <a href="#type-challenge"><code>challenge</code></a> to a string compatible with the HTTP/1.1 wire format for authentication challenges.</p><p>For example, a <code>`Basic</code> challenge with realm <code>&quot;foo&quot;</code> will be marshalled to <code>&quot;Basic realm=foo&quot;</code>, which can then be combined with a <code>www-authenticate</code> HTTP header and sent back to the client. There is a helper function <a href="../Header/index.html#val-add_authorization_req"><code>Header.add_authorization_req</code></a> that does just this.</p></div></div></div></body></html>