intro.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Introduction
  2. ============
  3. How does it work?
  4. -----------------
  5. At a high level, this is what happens when a user wants to log into a site that
  6. uses django-browserid:
  7. 1. A user clicks a login button on your web page.
  8. 2. The JavaScript shim (hosted by Persona_) displays a pop-up asking for the
  9. email address the user wants to log in with.
  10. 3. If necessary, the pop-up prompts the user for additional info to
  11. authenticate them. For example, if the user enters an `@mozilla.com` email,
  12. the Mozilla LDAP Identity Provider will prompt them for their LDAP password.
  13. 4. The JavaScript receives an "assertion" from the Identity Provider and
  14. submits it to the site's backend via AJAX.
  15. 5. The backend sends the assertion to the `Remote verification service`_, which
  16. verifies the assertion and returns the result, including the email address
  17. of the user if verification was successful.
  18. 6. The backend finds a user account matching that email (creating it if one
  19. isn't found) and logs the user in as that account.
  20. 7. The backend returns a URL that the JavaScript redirects the user to.
  21. Note that this is just an example flow. Several of these steps can be
  22. customized for your site; for example, you may not want user accounts to be
  23. created automatically. This behavior can be changed to suit whatever needs you
  24. have.
  25. A `detailed explanation of the BrowserID protocol`_ is available on MDN.
  26. .. _`detailed explanation of the BrowserID protocol`: https://developer.mozilla.org/Persona/Protocol_Overview
  27. .. _Persona: https://www.persona.org
  28. .. _`Remote Verification Service`: https://developer.mozilla.org/Persona/Remote_Verification_API
  29. .. _persona-dependence:
  30. Persona
  31. -------
  32. By default, django-browserid relies on Persona, which is a set of
  33. BrowserID-related services hosted by Mozilla. It's possible, but annoying, to
  34. use django-browserid without these dependencies.
  35. Currently, django-browserid relies on Persona for:
  36. - The `Cross-browser API Library`_, which implements the ``navigator.id`` API
  37. for browsers that don't natively support BrowserID.
  38. - The `Fallback Identity Provider`_ for emails from servers that don't support
  39. BrowserID.
  40. - The `Remote verification service`_, which handles assertion verification for
  41. sites that don't want to verify assertions themselves.
  42. In the future, django-browserid will remove the need to depend on these
  43. Mozilla-centric services. Local verification and a self-hosted cross-browser
  44. API will greatly reduce the reliance on Mozilla's servers for authentication.
  45. .. _`Cross-browser API Library`: https://developer.mozilla.org/Persona/Bootstrapping_Persona#Cross-browser_API_Library
  46. .. _`Fallback Identity Provider`: https://developer.mozilla.org/Persona/Bootstrapping_Persona#Fallback_Identity_Provider