This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-06
Channels
- # aleph (2)
- # aws (3)
- # bangalore-clj (3)
- # beginners (119)
- # boot (263)
- # cider (13)
- # cljs-dev (16)
- # clojars (2)
- # clojure (114)
- # clojure-austin (1)
- # clojure-chicago (1)
- # clojure-finland (1)
- # clojure-france (24)
- # clojure-italy (6)
- # clojure-russia (28)
- # clojure-serbia (7)
- # clojure-spain (1)
- # clojure-spec (89)
- # clojure-uk (139)
- # clojurescript (216)
- # community-development (3)
- # core-async (135)
- # css (2)
- # cursive (31)
- # datomic (44)
- # emacs (15)
- # hoplon (2)
- # jobs (3)
- # lein-figwheel (14)
- # leiningen (2)
- # lumo (21)
- # off-topic (16)
- # om (7)
- # om-next (1)
- # onyx (53)
- # perun (9)
- # planck (15)
- # portland-or (29)
- # protorepl (2)
- # re-frame (32)
- # reagent (8)
- # ring-swagger (22)
- # rum (51)
- # spacemacs (4)
- # untangled (2)
Hi, should this be still valid: https://gist.github.com/Deraen/ef7f65d7ec26f048e2bb
Getting this exception: Caused by: java.lang.IllegalArgumentException: No method in multimethod 'restructure-param' for dispatch value: :auth-rules
@leena Yes, it should work
Have you required backend.restructure
on the namespace where you try to use :auth-rules
The error might be caused by the multimethod implementation not being loaded
We would actually not need the session part, is there a simpled example somewhere with just token and buddy with compojure-api?
@leena I don't think so, but the only change should be remove wrap-session
and provide buddy middlewares with token backend instead of session: https://funcool.github.io/buddy-auth/latest/api/buddy.auth.backends.token.html
the restructure-params would stay the same, as buddy middlewares add same :identity
property to the request map
Oh, and you wouldn't need login and logout routes
For authentication in Swagger-UI, it is possible to configure api token auth for Swagger
I have and you need some code to generate the tokens for clients. I have a example in one project, I'll update the gist.
that depends what data the token contains (or if the token just points to a entity in database)
@leena https://gist.github.com/Deraen/ef7f65d7ec26f048e2bb#file-token_handler-clj this might help a bit
I think the :authfn
option of jws backend is where you should check if the token is valid
then the authenticated
etc predicates work like normally, (:identity request)
would always contain information about valid user data
if the current user is not needed, a simple middleware would be enougj :middleware [wrap-require-token]
?
@ikitommi Optimal solution would be for each endpoint 1. check if token is valid and 2. parse/unsign it 3. get user from token for that particular endpoint