This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-10
Channels
- # announcements (1)
- # babashka (178)
- # beginners (216)
- # bootstrapped-cljs (1)
- # brompton (5)
- # calva (3)
- # chlorine-clover (1)
- # clj-kondo (2)
- # cljdoc (37)
- # cljfx (4)
- # cljs-dev (2)
- # clojure (360)
- # clojure-chile (8)
- # clojure-europe (3)
- # clojure-italy (5)
- # clojure-nl (9)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (61)
- # clojuredesign-podcast (1)
- # clojurescript (83)
- # clr (2)
- # conjure (4)
- # core-async (14)
- # cursive (20)
- # data-science (2)
- # datomic (15)
- # docker (11)
- # emotion-cljs (1)
- # figwheel-main (28)
- # find-my-lib (1)
- # fulcro (46)
- # helix (16)
- # honeysql (14)
- # jobs (10)
- # jobs-discuss (17)
- # joker (1)
- # juxt (9)
- # kaocha (8)
- # leiningen (3)
- # meander (3)
- # news-and-articles (1)
- # off-topic (110)
- # pathom (7)
- # pedestal (4)
- # protojure (2)
- # re-frame (12)
- # reagent (25)
- # ring (4)
- # shadow-cljs (109)
- # spacemacs (9)
- # specter (1)
- # sql (3)
- # tools-deps (23)
nope, its open for you to decide, a common pattern is provide some auth-token on the environment so the resolvers can use it
Alright, we have been using the environment to handle our concern, and had a false start by trying to incorporate some of the grant/role information as ::pc/input
properties
I was looking into a way to tag mutations/resolvers with auth needs, and came across the transform https://wilkerlucio.github.io/pathom/v2/pathom/2.2.0/connect/shared-resolvers.html#connect-transform helper. I think something like this shape would get there
(defn simple-tform
[{::pc/keys [mutate resolve] :as env}]
(log/info "ENV is: ") (pprint env)
(if resolve
(assoc env ::pc/resolve
(fn [en params]
(log/info "IN simple tform resolve")
(resolve en params)))
(assoc env ::pc/mutate
(fn [en params]
(log/info "IN simple tform mutate")
(log/info "env is: ")
(pprint (keys en))
(mutate en params)))))
(pc/defresolver res1 [_ _]
{::pc/output [::test]
::pc/transform simple-tform
::my-ns/require-auth? true
::my-ns/auth-roles #{:admin}}
(log/info "Hello")
{::test "hello this is my name"})