This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-03
Channels
- # boot-dev (1)
- # cider (27)
- # cljsjs (6)
- # cljsrn (11)
- # clojure (249)
- # clojure-dusseldorf (1)
- # clojure-finland (1)
- # clojure-greece (1)
- # clojure-italy (28)
- # clojure-nl (12)
- # clojure-russia (2)
- # clojure-spec (5)
- # clojure-uk (27)
- # clojurescript (24)
- # clojutre (2)
- # component (8)
- # cryogen (1)
- # cursive (7)
- # datomic (61)
- # editors (18)
- # emacs (1)
- # events (1)
- # figwheel (4)
- # fulcro (35)
- # graphql (4)
- # jobs (3)
- # jobs-rus (1)
- # keechma (1)
- # leiningen (1)
- # london-clojurians (1)
- # luminus (62)
- # off-topic (154)
- # onyx (23)
- # pedestal (43)
- # portkey (66)
- # re-frame (49)
- # reagent (23)
- # shadow-cljs (92)
- # tools-deps (113)
- # uncomplicate (2)
I switched my ns.<app>.middleware to [buddy.auth.backends.token :refer [jws-backend]] in line with https://funcool.github.io/buddy-auth/latest/api/buddy.auth.backends.token.html but I’m getting an error: “Could not locate buddy/auth/backends/tokens/jws__init.class or buddy/auth/backends/tokens/jws.clj on classpath”. Any ideas?
@eoliphant Just buddy but there are numerous references to budy.auth in the app’s middleware namespace.
If so why does this work: [buddy.auth.backends.session :refer [session-backend]], ie. the default?
@eoliphant Maybe buddy-auth is a dep.
@eoliphant Then the buddy-auth docs are misleading: https://funcool.github.io/buddy-auth/latest/#signed-jwt
The buddy-auth code in Luminus seems to be totally different than what’s in the buddy-auth docs.
Very confusing. I think the authors of buddy-auth could have made this a bit more beginner-friendly.
What hope does a newcomer to Clojure web development have trying to make sense of all this?
This is a classic supporting argument for a Clojure web framework. I mean Luminus is great as far as it goes but it’s only a guide to curated libraries at best. “Web Development with Clojure”, as far as I can tell only has an OAuth example and doesn’t touch the Buddy stuff.
According to the buddy docs I can simply call (backends/jws {:secret “mysecret”}) but I can’t get it to work.
backends/jws
shold be fine. based on your error you have backends.token/jws
which doesn’t exists
Last I tried was: [buddy.auth.backends.token :refer [jws-backend]] . Combined with (let [backend (jws-backend {:secret “mysecret”})]
It’s always “Could not locate buddy/auth/backends/tokens/jws__init.class or buddy/auth/backends/tokens/jws.clj on classpath”
Even the error message doesn’t match what I specified, ie. backends.token not backends.tokens . Jeeeezus.
Thanks @eoliphant but I’ve wasted the best part of a week trying to untangle this knot in order to get my app off the ground. The Clojure community is just too wedded to its libraries-only philosophy so I’ll give Node a shot.
;; requires
...
[buddy.auth.backends.token :refer [jwe-backend jws-backend]]
[buddy.sign.jwt :refer [encrypt sign]]
...
(def token-backend
(jws-backend {:secret secret}))
(defn token [username role id]
(let [claims {:user (keyword username)
:role role
:id id
:exp (plus (now) (minutes 60))}]
;(encrypt claims secret {:alg :a256kw :enc :a128gcm})
(sign claims secret)
))
well if you look at it again, gen a luminus project with the buddy-jwt option, and compare that config to yours. I think you may just have something mistyped somewhere