Add support for included credentials in webhook targets.

Review Request #8916 - Created April 27, 2017 and updated

David Trowbridge
Review Board

Sometimes, a user may need to dispatch a webhook to an authenticated endpoint.
Django (somewhat sensibly) does not allow inline credentials in URLFields, both
in forms and models, but in this case we want to allow it.

This change adds a new validator that works like Django's URLValidator but
includes the credentials within the regex. The URL is then split and
credentials (if included) are pulled out and added to a HTTPBasicAuthHandler
for the url open.

  • Verified that I was able to save webhook targets that included credentials
    in the URL.
  • Checked that things that definitely weren't URLs were still rejected.
  • Ran unit tests.
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
David Trowbridge
Review request changed

Checks run (2 succeeded, 1 failed with error)

JSHint passed.
Pyflakes passed.
PEP8 Style Checker internal error.