Skip to content

Add API token authentication. #9

@lovelydinosaur

Description

@lovelydinosaur

At the moment Basic authentication only support username/password.

It'd be great if it could also be used with token objects, stored in the database, where each token has a key, a secret, and is tied to a user.

The right way to do this would be to write a standard django auth backend that validates (username, password) arguments against an APIToken table rather than the standard backend which validates it against the User table.

After that I'd modify the BasicAuthentication class, adding a 'backend' attribute, which would be unset by default. If the attribute is not set then the class would simply call 'authenticate(username, password)', otherwise it would call backend.authenticate(username, password).

TokenBasicAuthentication would then simply extend BasicAuthentication, setting 'backend=APITokenBackend'.

It would be nice if the token table didn't get installed by default on syncdb unless it's actually being used.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions