Add support for webapi auth backends.

Review Request #5081 — Created Dec. 9, 2013 and submitted

Information

Djblets
release-0.7.x

Reviewers

Add support for webapi auth backends.

This adds support for custom auth backends for the webapi. API auth
backends are a simple class that pulls credentials from a request and
authenticates with them. They're designed to work for common methods
(like Basic HTTP Auth) and to be subclassable for something more complex
(such as one-time password tokens).

Multiple auth backends can be specified, and each will be tried until a
matching request is found. This means we'll be able to add Digest Auth
soon, in theory.

Tested authenticating with this. No problems.

Also tested with a custom, experimental auth backend for two-factor auth.
It worked as well.

Description From Last Updated

Shouldn't this return an error message as the second part of the tuple?

daviddavid
david
  1. 
      
  2. djblets/webapi/auth.py (Diff revision 1)
     
     
    Show all issues

    Shouldn't this return an error message as the second part of the tuple?

    1. By not including one, it uses the default for the LOGIN_FAILED WbAPIError (saying that the username or password is invalid). This is more for custom things like "You must enter a one-time password. Check yourt texts." or something.

    2. Hmm. Can we make that clearer in the comments? It does say "use the defaults" but I'd like to see it say something like your reply here.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed