Fork me on GitHub
#reitit
<
2018-12-06
>
ikitommi21:12:55

@plins haven’t seen examples in the wild, we are using buddy in most projects and wrote an issue to pre-integrate it as a separate module (https://github.com/metosin/reitit/issues/154).

👍 4
plins21:12:02

this would be very nice indeed, im quite confused where I should stack it in the middleware list, or how to choose per route which route gets protected with what

ikitommi21:12:07

yeah. despite the buddy-mw (or any other mw) can be normally, the good practise with reitit is to spec and push the definitions into route data and create a new middleware that reads those at creation time, and configures & mounts the actual mw based on those. Just need to figure out a good new authentication route data spec.

ikitommi21:12:28

ideas on that most welcome.

plins21:12:32

Just need to figure out a good new authentication route data spec you mean the default endpoints?

plins21:12:10

for basic stuff like sign-in, sign-out ?

ikitommi21:12:03

Buddy has the concepts :backend and :rules.

ikitommi21:12:21

somehow those should be put to route-data. “these routes use the basic-auth backend”, “these routes are only for admins and managers”

ikitommi21:12:16

maybe just :auth/backend and :auth/rules? we have used custom route data keys like :roles-allowed.

plins21:12:22

sounds good to me

plins21:12:50

dont see any problems with custom keys

plins21:12:58

maybe an easy way to customize those back ends, lets say id like to store JWT tokens inside redis, I could provide a function to do so and it would integrate with the hole auth lifecycle