Easy way to wrap an existing HttpRoute in Auth? #6870
Replies: 3 comments 1 reply
-
@armanbilge thanks! Sorry about the issue! |
Beta Was this translation helpful? Give feedback.
-
@Marcus-Rosti do you mean some method like def liftToAuthRoutes[F[_]](httpRoutes: HttpRoutes[F]): AuthedRoutes[Unit, F] =
Kleisli { areq => httpRoutes(areq.req) } ❔ |
Beta Was this translation helpful? Give feedback.
-
Well, neither def liftToAuthRoutes[F[_]: Functor](httpRoutes: HttpRoutes[F]): AuthedRoutes[Unit, F] =
Kleisli { areq => OptionT.liftF(httpRoutes.orNotFound(areq.req)) } |
Beta Was this translation helpful? Give feedback.
-
If I have a
val routes: HttpRoutes[F]
is there an easy way to turn it intoval authed: AuthedRoutes[Unit, F]
I want to wrap some routes in a JWT and there's no user specific or ContextRequest needed. Just 👍 vs 👎 .
The other piece of context is that there are other routes, say, metrics & liveness, that don't need authentication.
Maybe this is all just the nubile, not used to using HttpRoutes or Routers? Anyway, thanks!
Beta Was this translation helpful? Give feedback.
All reactions