top | item 44187471

(no title)

ripley12 | 9 months ago

This is very useful, thanks. I've implemented similar authentication with tower_cookies in a home project, and it took me a long time to figure out; Axum is powerful but not always the most intuitive. It was a great learning experience, but I'd love to offload more of this to a crate next time.

discuss

order

tonyhart7|9 months ago

I think https://loco.rs/ is better choice for you then

echelon|9 months ago

Rust ORMs still don't feel great. They're verbose, the tooling is flaky, and they feel fly-by-night. They're surprisingly not very type safe either. I'd rather use Rust's sqlx until the Rust ORM situation improves.

Axum and Actix are already drop in replacements for something like Flask. They're mature and good at what they do.

The dream of a Rails or Django in Rust is still really far off. I'm glad the Loco folks are trying, but it needs a lot more magic and maturity to truly bear that comparison.

Scarblac|9 months ago

I looked into it recently. Apparently it has session based auth.

I tried to figure out how to do the first thing that came to mind: on an incoming request, check that the user is authenticated, and if not redirect them to a login page with a ?next= parameter to be redirected back to after login.

Couldn't find a way to do it. In Django you use the @login_required decorator on a view and that's it.