Scan for third party auth backends and allow for custom settings forms.

Review Request #1951 — Created Nov. 27, 2010 and submitted


Review Board


Scan for third party auth backends and allow for custom settings forms.

Our bundled auth backends, while often used, weren't enough for many places.
Several companies and projects have written custom auth backends. Our support
for using these was minimal. We would make the admin specify the Python module,
and any customization of the settings would have to be done either within the
module or within

In this new scheme, all authentication backends, including our own (with the
exception of the built-in database-backed auth provided by Django), are scanned
using the same sort of pkg_resources hooks that we use for SCMTools. We provide
all available auth backends in the Authentication Settings page, and each
auth backend can specify its own settings form. The settings will be saved into
the siteconfig database entry automatically.

Third parties now need only write an auth backend as an installable Python
module that registers into the 'reviewboard.auth_backends' entry point
and it will show up. They can specify a SiteSettingsForm instance for use
in the admin UI, and it will be shown when the auth backend is shown. This
should greatly simplify things for third parties.
Tested that the various auth backends we provide load and save properly.

Verified they're all scanned from the entry point instead of hard-coded.

Tested validation errors on a settings form for a backend, and that switching
to another backend won't show any validation errors for that backend until saved.

Tested that only the selected auth backend is ever saved.
  1. Very nice!
    It would be cool if this could also address issue 880.
    1. Oh, yes, I think I'll do that as a follow-up change to this. I'd love to get rid of all hard-coded logic for auth modules in this release.