package ez_api
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Easy API library and tools
Install
dune-project
Dependency
Authors
Maintainers
Sources
3.0.0.tar.gz
md5=9069f59ac83c958cedc90a25f24faa1e
sha512=4b066a759043e6704a9617bdc412d29f7ded058cb0e01eb3a8207f54b80bebb478bb98a96832e61b15d281bc8f132e1386459c563eb807a51c01324541fe28b2
doc/src/ez_api/security.ml.html
Source file security.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66(**************************************************************************) (* *) (* Copyright 2018-2023 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1, with the special *) (* exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) open Misc type uninhabited = | type none = [ `Nosecurity of uninhabited ] type 'a apikey = { ref_name : string; name : 'a } type bearer_desc = { bearer_name : string ; format : string option } type basic_desc = { basic_name : string } type bearer = [ `Bearer of bearer_desc ] type basic = [ `Basic of basic_desc ] type header = [ `Header of string apikey ] (* cookie name * max age atribute (defaults to 1 day) *) type query = [ `Query of Param.t apikey ] type scheme = [ | none | basic | bearer | header | cookie | query ] let unreachable = function (_ : uninhabited) -> . let ref_name = function | `Nosecurity u -> unreachable u | `Basic { basic_name = ref_name } | `Bearer { bearer_name = ref_name; format=_ } | `Cookie ({ ref_name; name=_ }, _ ) | `Header { ref_name; name=_ } | `Query { ref_name; name=_ } -> ref_name let params (l : [< scheme ] list) = List.fold_left (fun acc -> function | `Query { name = param ; _ } -> param :: acc | `Nosecurity _ | `Basic _ | `Bearer _ | `Header _ | `Cookie _ -> acc ) [] l let headers (sec : [< scheme ] list) = List.fold_left (fun headers -> function | `Nosecurity _ -> headers | `Basic _ | `Bearer _ -> StringSet.add "authorization" headers | `Query _ -> headers | `Header { name; _ } -> StringSet.add name headers | `Cookie _ -> StringSet.add "cookie" headers ) StringSet.empty sec let ~kind s = [ "authorization", kind ^ " " ^ s ] let make_security (sec: scheme) s = match sec with | `Nosecurity _ -> [], [] | `Bearer _ -> make_authorization_headers ~kind:"bearer" s, [] | `Basic _ -> make_authorization_headers ~kind:"basic" s, [] | `Header {name; _} | `Cookie ({name; _}, _) -> [ name, s ], [] | `Query {name; _} -> [], [ name, Param.TYPES.S s ]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>