NodeJS interceptor in Rust

I'm looking for solution that checks if a user is validated before a endpoint request on my actix-web server. Is there something similar like interceptors in NodeJS?

Do you mean a middleware?

This seems to be the solution I'm looking for. Do you have any experience with that? I want to use this for user validation before handling the request.

Yes, I've used middleware in actix-web for authentication and authorization with OpenID Connect before. You can check it out here, though the crate is seriously outdated (still on actix-web 3) and poorly documented, so probably not much use for you. Middleware in actix-web is slightly advanced and more clunky to work with compared to the ergonomics of writing routes and endpoints, but no magic.

You should probably also check out the actix-web-httpauth for ways to extract authentication data from the request headers. It even provides a HttpAuthentication middleware you might be able to use for your purposes.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.