This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-03
Channels
- # admin-announcements (2)
- # beginners (18)
- # boot (118)
- # cider (12)
- # cljs-dev (12)
- # cljsrn (24)
- # clojure (142)
- # clojure-art (4)
- # clojure-bangladesh (3)
- # clojure-ireland (1)
- # clojure-italy (7)
- # clojure-norway (4)
- # clojure-poland (207)
- # clojure-russia (101)
- # clojurescript (108)
- # clojurewerkz (2)
- # core-async (6)
- # css (8)
- # data-science (23)
- # datomic (31)
- # devcards (2)
- # emacs (8)
- # funcool (25)
- # hoplon (34)
- # immutant (78)
- # ldnclj (7)
- # lein-figwheel (4)
- # leiningen (6)
- # luminus (35)
- # off-topic (1)
- # om (119)
- # onyx (43)
- # parinfer (29)
- # proton (11)
- # re-frame (25)
- # remote-jobs (1)
- # slack-help (1)
- # spacemacs (3)
- # yada (10)
Hi guys once more !, anyone has tried the cookie auth settings specified in doc https://github.com/juxt/yada/blob/master/manuscript/100_security.md#cookie-authentication I'm trying now but i got schema validation error this is my code
:access-control {:scheme :cookie
:cookie "MY_COOKIE"
:verify (fn [cookie]
(println "cookie: " cookie)
true)}
and this is the result
to a resource-model schema
{:resource-model
{:id "Hello World!\n",
:produces "application/json",
:methods
{:get
{:response
#function[ch.deepimpact.tamara.system/eval95110$fn--95111]}},
:access-control
{:scheme :cookie,
:cookie "MY_COOKIE",
:verify
#function[ch.deepimpact.tamara.system/eval95110$fn--95113]}},
:error {:access-control {(not (namespace :cookie)) invalid-key}}}
I tried to remove :cookie key but anyway i dont get the println call😕 I'm in the process to upgrade my project to use current yada version [yada "1.1.0-20160228.233732-31"]
@tangrammer You might want to look at dev/src/yada/dev/security.clj
for a working example. A key part of getting this to work is that you need to write a method that implements verify
for :cookie
thanks @fahey but I'm providing the verify fn too ^ and anyway this code doesn't explain the doc issue
@tangrammer: That's the thing though, verify can't just be a fn. You have to use defmethod
. Here is a snippet from my own setup:
(defmethod verify :cookie
[ctx {:keys [verify]}]
(let [the-cookie (get-in ctx [:cookies "session"])]
(when-let [user (and the-cookie
(mylib/check-user-cookie the-cookie))]
;; etc
)))
@fahey: thanks!, now I got the idea and the code running