This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-19
Channels
- # announcements (1)
- # babashka (26)
- # beginners (42)
- # calva (3)
- # cider (5)
- # cljs-dev (7)
- # cljsjs (1)
- # cljsrn (13)
- # clojure (95)
- # clojure-europe (12)
- # clojure-germany (3)
- # clojure-italy (12)
- # clojure-nl (1)
- # clojure-spec (16)
- # clojure-uk (25)
- # clojurescript (13)
- # clojureverse-ops (5)
- # community-development (1)
- # conjure (8)
- # cryogen (3)
- # datomic (5)
- # deps-new (7)
- # exercism (1)
- # fulcro (34)
- # honeysql (9)
- # hyperfiddle (3)
- # instaparse (2)
- # introduce-yourself (2)
- # jobs (6)
- # kaocha (1)
- # lambdaisland (1)
- # lsp (47)
- # malli (3)
- # membrane (38)
- # off-topic (9)
- # polylith (36)
- # reitit (7)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (11)
- # spacemacs (7)
- # sql (7)
- # tools-deps (19)
yep you need to add a middleware to the swagger route that checks for the presence of the header
Great, I tried this without success so far 😄 did you use buddy? @U3QUAHZJ6
no buddy experience but:
the middleware needs to check if there is a Authorization: Basic ....
header
if the header is there, decode it and check its contents, if its not
then return 401
with the WWW-Authenticate: Basic realm="User Realm"
and the browser will ask for the crendentials
attach that middleware to the swagger html endpoint or the json endpoint (I dont remember which one Ive used)
Im having a hard time understanding why this request gets parsed correctly in this first example everything is parsed as expected
clj => (do (prn (:headers request)) (prn (-> request :parameters :body))
{"user-agent" "Restler/0.17.6 (android)",
"host" "192.168.1.200:3002",
"accept-encoding" "gzip, deflate, br",
"content-length" "18",
"content-type" "application/json"}
{:employees [1]}
but here it fails
{"te" "gzip, deflate; q=0.5",
"user-agent"
"Dalvik/2.1.0 (Linux; U; Android 9; SM-A530F Build/PPR1.180610.011)",
"connection" "keep-alive",
"host" "192.168.1.200:3002",
"accept-encoding" "gzip",
"content-length" "86",
"content-type" "application/json"}
"{\"employees\":[1]}"