settings.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. Settings
  2. ========
  3. .. currentmodule:: django.conf.settings
  4. This document describes the Django settings that can be used to customize the
  5. behavior of django-browserid.
  6. Core Settings
  7. -------------
  8. .. attribute:: BROWSERID_AUDIENCES
  9. :default: No default
  10. List of audiences that your site accepts. An audience is the protocol,
  11. domain name, and (optionally) port that users access your site from. This
  12. list is used to determine the audience a user is part of (how they are
  13. accessing your site), which is used during verification to ensure that the
  14. assertion given to you by the user was intended for your site.
  15. Without this, other sites that the user has authenticated with via Persona
  16. could use their assertions to impersonate the user on your site.
  17. Note that this does not have to be a publicly accessible URL, so local URLs
  18. like ``http://localhost:8000`` or ``http://127.0.0.1`` are acceptable as
  19. long as they match what you are using to access your site.
  20. Redirect URLs
  21. -------------
  22. .. note:: These settings also accepts view function names and named URL
  23. patterns which can be used to reduce configuration duplication since you
  24. don't have to define the URL in two places (settings and URLconf).
  25. .. attribute:: LOGIN_REDIRECT_URL
  26. :default: ``'/accounts/profile'``
  27. Path to redirect to on successful login. If you don't specify this, the
  28. default Django value will be used.
  29. .. attribute:: LOGIN_REDIRECT_URL_FAILURE
  30. :default: ``'/'``
  31. Path to redirect to on an unsuccessful login attempt.
  32. .. attribute:: LOGOUT_REDIRECT_URL
  33. :default: ``'/'``
  34. Path to redirect to on logout.
  35. .. _reverse_lazy: https://docs.djangoproject.com/en/dev/ref/urlresolvers/#reverse-lazy
  36. Customizing the Login Popup
  37. ---------------------------
  38. .. attribute:: BROWSERID_REQUEST_ARGS
  39. :default: ``{}``
  40. Controls the arguments passed to ``navigator.id.request``, which are used to
  41. customize the login popup box. To see a list of valid keys and what they do,
  42. check out the `navigator.id.request documentation`_.
  43. .. _navigator.id.request documentation: https://developer.mozilla.org/en-US/docs/DOM/navigator.id.request
  44. Customizing the Verify View
  45. ---------------------------
  46. .. attribute:: BROWSERID_VERIFY_CLASS
  47. :default: ``django_browserid.views.Verify``
  48. Allows you to substitute a custom class-based view for verifying assertions.
  49. For example, the string 'myapp.users.views.Verify' would import `Verify`
  50. from `myapp.users.views` and use it in place of the default view.
  51. When using a custom view, it is generally a good idea to subclass the
  52. default Verify and override the methods you want to change.
  53. .. attribute:: BROWSERID_CREATE_USER
  54. :default: ``True``
  55. If ``True`` or ``False``, enables or disables automatic user creation during
  56. authentication. If set to a string, it is treated as an import path
  57. pointing to a custom user creation function.
  58. .. attribute:: BROWSERID_DISABLE_SANITY_CHECKS
  59. :default: False
  60. Controls whether the ``Verify`` view performs some helpful checks for common
  61. mistakes. Useful if you're getting warnings for things you know aren't
  62. errors.
  63. Using a Different Identity Provider
  64. -----------------------------------
  65. .. attribute:: BROWSERID_SHIM
  66. :default: 'https://login.persona.org/include.js'
  67. The URL to use for the BrowserID JavaScript shim.
  68. Extras
  69. ------
  70. .. attribute:: BROWSERID_AUTOLOGIN_ENABLED
  71. :default: ``False``
  72. If ``True``, enables auto-login. You must also set the auto-login email and
  73. authentication backend for auto-login to function. See the documentation on
  74. :ref:`offline development <offline-development>` for more info.
  75. .. attribute:: BROWSERID_AUTOLOGIN_EMAIL
  76. :default: Not set
  77. The email to log users in as when auto-login is enabled. See the
  78. documentation on :ref:`offline development <offline-development>` for more
  79. info.