mozilla/browserid — pull request #2761 by ozten (2012-11-22 00:13:42+00:00)
Title: B2g forceIssuer support

What is it?

if you

1) go to http://192.168.186.138:10001/
2) check Force Issuer to issuer.domain and click "Get an Assertion"
3) enter a primary email like 'test@example.domain' and click Next
4) Create a password
5) Get VERIFICATION URL out of logs and go there

Note: You're logged in and the assertion was backed by 'issuer.domain'.

Note: The assertion is verified by the verifier.

This is because config/local.json adds this setting.

Caveats:

This patch is rushed and the frontend code is fairly horrible. Lots of duplicate code, I don't like the use of the `User.forceIssuer` as a global variable, etc.

How did storage get so ugly?
Why forceIssuerEmails?
localStorage is a flat key value store, so we couldn't do:

* storage.default.emails and storage.fxos.emails
* dynamic keys (such as using fxos.login.persona.org) don't work well with removeItem and other APIs here.
* We can refactor all writes to emails to use a default or issuer based bucket

Why keep storage.forceIssuerEmails up to date for all addresses?
`user.checkAuthenticationAndSync` is called without us knowing which specific
email the user is trying to forceIssuer on.