actix / actix-web-httpauth Goto Github PK
View Code? Open in Web Editor NEWMoved to actix-extras repo.
Home Page: https://github.com/actix/actix-extras/tree/HEAD/actix-web-httpauth
License: Apache License 2.0
Moved to actix-extras repo.
Home Page: https://github.com/actix/actix-extras/tree/HEAD/actix-web-httpauth
License: Apache License 2.0
Hello!
I'm trying to use the middleware you've provided in a crate to implement OAuth2, and I've come to the realization I need access to the ServiceRequest
in my validator_fn
in order to set an extension. Since ServiceRequest
is only borrowed, I can't move it into the future returned by the validator_fn
.
You could enable this just by making validator_fn
own the ServiceRequest
and requiring that it return an IntoFuture<Item = ServiceRequest, ...>
Hi @svartalf,
I was using this crate on a personal project that I'm trying to move to actix-web 2.0. Since I didn't want to reinvent the wheel (and probably don't have enough experience) I thought I'd try to migrate actix-web-httpauth to the new version.
After much trial and error I managed to get something that compiles (huge milestone for me), and it actually even works when used inside my (very basic) project!
(Note: The stress is in "trial and error"; you won't necessarily find best practices applied here.)
I didn't migrate the tests, and my project only uses Basic auth (not Bearer), so there might be issues lurking in there. In any case, I wanted to check if this initial "migration" would be of interest to you in order to kick-start the next "official" version of actix-web-httpauth, compatible with actix-web 2.0.
You can see my changes in this branch. If you think it's worth progressing, I could spend some more time on the tests and then create a PR.
Cheers,
Alfonso
The actix-web is getting close to 1.0.0 release and it had a major rework and made it way easier to use.
We'd like to adopt your crate for one of our services we are doing. Would you be willing to add support for it?
Hi,
I've seen, in issue #8, that the ServiceRequest
ownership has been modified in a recent release to allow for modification of the request before re-sending as a future. In fact, the example provided by @asonix uses request.extensions_mut().insert()
, which is what I'm trying to use.
However, in my case I get an error stating that there's no extensions_mut() method in ServiceRequest. For what I can see, only HttpRequest provides access to this method.
Could you shed some light as to whether it's possible to modify the request's extensions within the process function?
Thanks & regards,
Alfonso
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.