Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Digest auth method #394

Open
wangyongxiao opened this issue Jan 30, 2024 · 2 comments
Open

Support for Digest auth method #394

wangyongxiao opened this issue Jan 30, 2024 · 2 comments
Labels
A-httpauth Project: actix-web-httpauth C-feature Category: new functionality good first issue Good for newcomers

Comments

@wangyongxiao
Copy link

is there have middleware can do Digest Auth in actix-web

actix_web_httpauth can only support Bearer and Basic

so how can support Digest Auth like

“WWW-Authenticate","Digest realm="test", qop="auth", nonce="MTcwMjUzOTAwMjAwMDplYmVmYjAwNzdkM2ZjMzU3MzRmNmZhZTUwOTBjOTM1Ng==”

@robjtede robjtede transferred this issue from actix/actix-web Jan 30, 2024
@robjtede robjtede added A-httpauth Project: actix-web-httpauth C-feature Category: new functionality labels Jan 30, 2024
@robjtede
Copy link
Member

If this is not possible with first-party tools, I'd consider this a feature request for actix-web-httpauth.

@robjtede robjtede added the good first issue Good for newcomers label Jan 30, 2024
@robjtede robjtede changed the title is there have middleware can do Digest Auth in actix-web Support for Digest auth method Jan 30, 2024
@joehasson
Copy link

Hi @robjtede I'm interested in working on this issue. I have a couple of thoughts around what the API for this should look like and would appreciate any feedback on the following.

  • Generating a challenge: In digest auth the challenge response needs to be generated uniquely for each new request (there are unique nonce and opaque values associated with each challenge). I would propose using a Config struct that wraps a challenge_factory(req) -> DigestChallenge closure, provided by the library user. The Config would then be stored in app data for later use by the extractor (similar to how basic and bearer auth are handled).
  • Handling missing config: If this Config isn't present in the app state then I think there are two options for generating a response.
    1. Just return a 500 Internal Server Error, effectively requiring users to provide a Config.
    2. Generate a challenge according to some reasonable defaults. The problem is that its not clear how to store the nonce and opaque value such that they can be properly verified when the client responds. Cookies are no good here because we need to check the nonce has not been used before. So maybe forcing users to pass a Config is the best approach.

Thanks in advance for any comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-httpauth Project: actix-web-httpauth C-feature Category: new functionality good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants