3
u/v1akvark Aug 20 '21
Interesting thanks.
We've just started a project with Mount, and liking it. Component requires so much boilerplate. Bleh.
11
u/armincerf Aug 20 '21
Could be worded clearer, but the recommendation was for integrant, not component. Nothing wrong with mount though, but I think that the cost of ‘boilerplate’ in integrant is worth the simplicity that comes with it. Mount tends to get difficult to work with after a while on big projects.
There is also https://github.com/juxt/clip which improves on integrant in a few areas but is less battle-tested
3
u/v1akvark Aug 20 '21
Thanks, I just realised I only read the blog post about the Radar, not the actual Radar article, I see there that integrant is suggested.
2
u/SimonGray Aug 28 '21
Where's Pedestal?
1
u/radioactiveoctopi Sep 05 '21
I’ve asked this before…as well as hunted for more info… outside of interceptors can you tell some of the more inexperienced developers ‘me’ where pedestal shines over ring?
2
u/SimonGray Sep 05 '21 edited Sep 05 '21
https://www.reddit.com/r/Clojure/comments/kefm7g/ringreitit_vs_pedestalreitit/gg4ilvn/
and my reply https://www.reddit.com/r/Clojure/comments/kefm7g/ringreitit_vs_pedestalreitit/gg52rj8/
Basically, the primary advantage of Pedestal is the simple, data-oriented approach vs. Ring's separate router + middleware (= function decorator) approach. This adds a lot of flexibility to dynamically inspect your web service code during runtime, allowing you do to stuff like what I describe in my second comment which wouldn't be possible in Ring.
This is the actual function that checks routes in advance (and just below that the interceptor chain that adds authorization to a route): https://github.com/kuhumcst/glossematics/blob/master/src/dk/cst/pedestal/sp/interceptors.clj#L386-L402
This is then used for example here: https://github.com/kuhumcst/glossematics/blob/master/src/dk/cst/pedestal/sp/example.clj#L21-L81
So based on SAML assertions about the user (returned from an external service after login), routes are dynamically tested while generating e.g. this basic page and links are either crossed over or not based on the authorization level of the user. The routes are looked up using the router which is fetched out of the interceptor context, making the whole thing entirely decoupled and reusable in other contexts.
I set the required authorization at the route level in my router exactly once per route and then I can call
permit-request?from anywhere, with no knowledge of router or the SAML code. It really simplified authorization for me to be able to inspect and run the router in this super decoupled way. And it is highly efficient, both in terms of lines of code and computationally.1
u/radioactiveoctopi Sep 07 '21
I see… well makes sense. I’m using it now, although slowly. I feel long term I’ll do better learning the ends and outs of pedestal.
6
u/hkjels Aug 21 '21
I like this way of keeping tabs on your dreamstack. I can’t speak to the lambda stuff, but I concur to the others in the adapt section of your radar. This is a nice contribution to the community. Thank you