This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-24
Channels
- # announcements (8)
- # aws (12)
- # babashka (84)
- # beginners (380)
- # calva (56)
- # clj-kondo (52)
- # cljdoc (4)
- # cljs-dev (327)
- # cljsrn (4)
- # clojure (154)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-uk (21)
- # clojurescript (52)
- # conjure (133)
- # cursive (64)
- # datomic (33)
- # emacs (22)
- # fulcro (35)
- # graalvm (24)
- # graphql (1)
- # kaocha (1)
- # leiningen (1)
- # off-topic (24)
- # onyx (2)
- # pathom (10)
- # re-frame (3)
- # reagent (3)
- # reitit (3)
- # shadow-cljs (48)
- # spacemacs (12)
- # tools-deps (98)
- # xtdb (7)
Interesting that nubank is using Flutter for delivery of mobile applications. fluff piece -> https://www.youtube.com/watch?v=vnj2i6RNo3g
How do you approach authentication and authorization in Clojure apps? I want to build application using Fulcro and PostgreSQL.
Hopefully someone more knowledgeable will chime in with a better answer but I recall that being asked a few times on reddit. https://www.reddit.com/r/Clojure/search/?q=authentication&restrict_sr=1
There's also Keycloak (http://www.keycloak.org/) keycloak-clojure (https://github.com/jgrodziski/keycloak-clojure) EDIT: I wanted to know if Keycloak is worth the effort.
I use 2 methods:
A function that (acl-query env current-user tx)
that remove attributes
that the user can't access from query
And directily on resolvers
Okay thats too broad - what kind of authentication OAuth, Session, JWT?
Session, JWT you can use buddy
library. it will take care of all of your authentication needs
github repo: https://github.com/funcool/buddy guide: http://rundis.github.io/blog/2015/buddy_auth_part1.html
@UGMEQUCTV JWT seems simpler mechanism, because application don't have to store sessions on server.
For user roles and permissions https://github.com/tuhlmann/permissions can be used.
You donāt have to use JWTs if you need stateless sessions; you can still use session cookies, just replace the session ID stored in the cookie with the data you would store in the JWT. Just keep in mind that stateless sessions prevent you from implementing things like ālog out from every sessionā. I always feel like Iām taking crazy pills when I talk about JWTs, because everyone is quick to use them when I think they have a number of problems. First, if youāre forcing your UI to store the JWTs in local/session storage, then any third-party library bundled with your UI JS can access those tokens, potentially giving them access to the userās account. Further, if you need to support authenticated downloads, then they either need to be small enough to load into memory via a JS-driven HTTP request, or you have to generate short-lived, one-off download URLs that donāt require authentication (JWTs have to be manually added to requests; the browser sends session data for you). They also make server-side rendering difficult if not impossible (again, because the initial page request comes from the browser, which can send cookies but not JWTs).
@UGTAV6LR2 I agree with you. I think JWTs are great for server-to-server communication but would not use them for user sessions.
Try keycloak with keycloak's gatekeeper. Gatekeeper forces the user to log in, and verifies the access token so you don't have to
Yea, assuming your browser is your only client, then session is your buddy. but what if you want to target the mobile devices i.e ios andriod phones. then session doesnt play out well. in such scenario jwt plays out particularly well. in short, there is no right answer, it depends on what you are trying to build!
@U2J4FRT2T kindly elaborate these methods, it would be great if there's sample code or examples. They seem relevant to Fulcro/Pathom. Thanks.
I'm out-of-time ATM But once I get same free time, I'm planning to release a realworld-app using fulcro/pathom/<top-secret-wip-library>, maybe with some blogposts about that.
@UCMNZLJ93here is a real world example using fulcro, you can refer to this atm. https://github.com/walkable-server/realworld-fulcro
(letfn [(filter-tx [allow? tx]
(->> tx
eql/query->ast
(eql/transduce-children (filter (comp allow? :dispatch-key)))
eql/ast->query))]
(let [role->alloed-attributes {:admin (constantly true)
:guest #{:a}}]
(filter-tx (:guest role->alloed-attributes)
[{:a [:c :a]}
{:b [:c :a]}])))
=> [{:a [:a]}]
Just found out from Reddit. Expecting an official announcement in Slack as well! https://clojurescript.org/news/2020-04-24-bundle-target
