Issue 2497 refactor to idp #3982
Conversation
|
fabulous! gets reviewing goggles |
| res.json({ 'public-key': publicKey.toSimpleObject() }); | ||
| res.json({ | ||
| 'public-key': publicKey.toSimpleObject(), | ||
| 'provisioning': '/provision', |
seanmonstar
Oct 16, 2013
Member
indent is off
indent is off
| @@ -12,6 +12,7 @@ Hub = (function() { | |||
| currID = 0; | |||
|
|
|||
| function on(message, callback, context) { | |||
| console.log('HUB ON ' + message); | |||
seanmonstar
Oct 16, 2013
Member
reminder to kill these console.logs before merge
reminder to kill these console.logs before merge
ozten
Oct 17, 2013
Author
Member
Ya, the version of Desktop codebase that this runs against has horrible dev tools, so I need these crutches.
Ya, the version of Desktop codebase that this runs against has horrible dev tools, so I need these crutches.
| '/common/js/helpers.js', | ||
| '/common/js/gettext.js', | ||
| '/common/js/browser-support.js', | ||
| 'common/js/enable_cookies_url.js', |
shane-tomlinson
Oct 17, 2013
Member
is this supposed to have a / prepended?
is this supposed to have a / prepended?
| // secondary addresses | ||
| const HOSTNAME = urlparse(config.get('public_url')).host; | ||
|
|
||
| try { |
shane-tomlinson
Oct 17, 2013
Member
It seems like this try/catch could be generalized and placed into primary.js
It seems like this try/catch could be generalized and placed into primary.js
shane-tomlinson
Oct 17, 2013
Member
my bad, secrets.js
my bad, secrets.js
ozten
Oct 17, 2013
Author
Member
This call is made from 7 sites in the code. Not all of them wrap in a try/catch.
I'd rather not do this change which is outside of the scope of this PR.
This call is made from 7 sites in the code. Not all of them wrap in a try/catch.
I'd rather not do this change which is outside of the scope of this PR.
| var wellKnown; | ||
| primary.checkSupport(domain, function(err, r) { | ||
| if (!err && r && r.urls) { | ||
| wellKnown = { |
shane-tomlinson
Oct 17, 2013
Member
Can both of these well known settings be extracted into functions?
Can both of these well known settings be extracted into functions?
ozten
Oct 17, 2013
Author
Member
Sure, what do you mean exactly? Something like this?
function prepareWellKnown(pubKey, provUrl, authUrl) {
provUrl = provUrl || config.get('public_url') + '/provision';
...
return {
"public-key": pubKey,
provisioning: provUrl,
...
}
}
Sure, what do you mean exactly? Something like this?
function prepareWellKnown(pubKey, provUrl, authUrl) {
provUrl = provUrl || config.get('public_url') + '/provision';
...
return {
"public-key": pubKey,
provisioning: provUrl,
...
}
}
| options = options || {}; | ||
| var self = this; | ||
|
|
||
| window.resizeTo(700, 440); // Gross |
shane-tomlinson
Oct 17, 2013
Member
resizeBy might give you better mileage, resizeTo includes browser chrome which can differ depending on toolbars.
resizeBy might give you better mileage, resizeTo includes browser chrome which can differ depending on toolbars.
| // params.origin = user.getOrigin(); | ||
| var rpInfo = bid.Models.RpInfo.create({origin: 'http://192.168.186.138:10001'}); | ||
| user.setRpInfo(rpInfo); | ||
| dialogHelpers.createUser.call(self, email, info.password, function(info) { |
shane-tomlinson
Oct 17, 2013
Member
Can these be extracted into functions? The pyramid o' doom is getting awfully deep.
Can these be extracted into functions? The pyramid o' doom is getting awfully deep.
| // TODO merge broke us - user.setRPInfo must now be called like in | ||
| // resources/static/dialog/js/modules/dialog.js line 130, 286 | ||
| // params.origin = user.getOrigin(); | ||
| var rpInfo = bid.Models.RpInfo.create({origin: 'http://192.168.186.138:10001'}); |
shane-tomlinson
Oct 17, 2013
Member
ya, we need this info for the origin somehow. Are all the RP parameters passed here? If so, we'll need tos/pp, siteLogo and backgroundColor as well.
ya, we need this info for the origin somehow. Are all the RP parameters passed here? If so, we'll need tos/pp, siteLogo and backgroundColor as well.
shane-tomlinson
Oct 17, 2013
Member
So... What we need is a way to get those parameters into this dialog.... We could drag over the channel stuff that allows you to call navigator.id.registerChannel, and then pass them in that way. We could use query strings. We could possibly stuff that info into local or sessionStorage? Indexeddb? Dunno what the best route forward is, would like to find out what capabilities you have.
So... What we need is a way to get those parameters into this dialog.... We could drag over the channel stuff that allows you to call navigator.id.registerChannel, and then pass them in that way. We could use query strings. We could possibly stuff that info into local or sessionStorage? Indexeddb? Dunno what the best route forward is, would like to find out what capabilities you have.
ozten
Oct 17, 2013
Author
Member
Do you have a SHA for before and after the rpinfo stuff?
What are the inputs and were do they come from? We should probably solve this in content space, but natively is also an option.
Do you have a SHA for before and after the rpinfo stuff?
What are the inputs and were do they come from? We should probably solve this in content space, but natively is also an option.
| }); | ||
| } | ||
| }, | ||
| function(err) { |
shane-tomlinson
Oct 17, 2013
Member
I wanna kill the error rendering with a spoon.
I wanna kill the error rendering with a spoon.
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
| BrowserID.Modules.IdPAuthentication= (function() { |
shane-tomlinson
Oct 17, 2013
Member
so, FWIU, this is a super mini state machine. With as yuck as the state machine is, we may want to use the generalized portion of it here if there is ever a point where the user can go back a screen within the IdP. I can help you with that if necessary.
so, FWIU, this is a super mini state machine. With as yuck as the state machine is, we may want to use the generalized portion of it here if there is ever a point where the user can go back a screen within the IdP. I can help you with that if necessary.
ozten
Oct 17, 2013
Author
Member
I'm trying to do this, but not really sure what to do. Can you make a pull request off of issue-2497-refactor-to-idp with a sketch (or complete implementation) of what you mean?
I'm trying to do this, but not really sure what to do. Can you make a pull request off of issue-2497-refactor-to-idp with a sketch (or complete implementation) of what you mean?
shane-tomlinson
Nov 7, 2013
Member
OTOH, we should hold off on adding the state machine functionality until we have more direction. No need to add complexity where it's not yet needed.
OTOH, we should hold off on adding the state machine functionality until we have more direction. No need to add complexity where it's not yet needed.
| </section> | ||
| <% } %> | ||
|
|
shane-tomlinson
Oct 17, 2013
Member
I believe the error/waiting/delay sections will need to be added here to handle when those events occur.
I believe the error/waiting/delay sections will need to be added here to handle when those events occur.
| getJSON('/wsapi/session_context', function(session, text, xhr) { | ||
| if (session.authenticated) { | ||
| getJSON('/wsapi/list_emails', function(data, text, xhr) { | ||
| if (data.emails.indexOf(email) === -1) { |
shane-tomlinson
Oct 17, 2013
Member
Is there ever a chance in hell we'll use this universally? If so, [].indexOf will break in IE8.
Is there ever a chance in hell we'll use this universally? If so, [].indexOf will break in IE8.
ozten
Oct 17, 2013
Author
Member
If IE8 implements persona natively and re-uses these flows, I'll eat my hat. :)
If IE8 implements persona natively and re-uses these flows, I'll eat my hat. :)
| }, | ||
| error: function(xhr, status, err) { | ||
| // TODO: Handle errors | ||
| if (console && 'function' === typeof console.log) { |
shane-tomlinson
Oct 17, 2013
Member
There is navigator.id.raiseProvisioningFailure I believe for this case.
There is navigator.id.raiseProvisioningFailure I believe for this case.
|
So... The devil hiding in the details, password resets and transition states. Are they going to be handled? |
Can we land this and start getting UX feedback, before implementing those features? |
|
Trying to get awsbox working, I've merged from dev, but got bitrot for the second time. I was able to see that logging.js moved and fix that. The other issue is that the dialog just comes up blank. To unblock myself, I've copied over scripts/deploy.js and changed the dependency to awsbox@0.6.2... but we'll have to figure out what changed about the dialog code that has broken the initial screen display for the new /auth screen. Any ideas? |
|
@ozten I'll do some git twiddling on Monday, see if I can cleanly apply your changes on top of current dev. |
|
ok, looking now. |
|
@ozten nice work so far! I was able to cleanly cherry-pick all the changes onto current dev (except for the commits merging dev into this branch). My branch is at https://github.com/6a68/browserid/tree/issue-2497-idp-rebased-not-merged. One tiny logging path change was needed to get tests running, that's on the HEAD of that branch, a7fd566. The local RP seems fine to me on my branch, I can log in and out. |
|
@6a68 is rocking the merge from dev to update this branch, you rule! Please try to reproduce the blank dialog I was seeing. You can download a Persona enabled Desktop build: Set a couple preferences (about:config):
Restart Firefox. dom.identity.persona_fallback defaults to our new ephemeral server https://desktoppersona.personatest.org/ but you can change this to any environment. Steps to reproduce:
Actual: empty dialog Expected: prompt to set a password |
|
@ozten happy to help :-) I've got the special FF build, I toggled the settings you mentioned (actually tried using the desktoppersona fallback as well as localhost), but I'm not sure what to do next. When I try to log into RPs, I click the persona button but nothing happens. Tried 123done, mozillians, nothing. Also not seeing errors in the JS console--maybe there's a desktop-specific console for the native code that I'm unaware of? I'll poke a bit more at my branch and yours, see if I can at least get an empty dialog using your branch. |
|
It looks like the blank dialog error was caused by using hashes, but the recently-landed #3971 I think means we should be using querystring instead. @ozten said this got him past the blank dialog problem in a local branch, I've updated my issue-2497-idp-rebased-not-merged branch with the fix (commit (9e8ed0f)[https://github.com/6a68/browserid/commit/9e8ed0f]). |
|
@ozten i don't have the The second image is broken for me. |
|
Thanks Jared! Using your patch, I see Thanks for continuing to dig for breaking changes from merging. |
|
I have my current branch running on https://rebasedidp.personatest.org. Will pick this up again in the morning. |
|
heh, I caused the Relay Error: we look for the hash, not the querystring, when we setup the channel. Removing that, or changing that code to look for ?NATIVE as window.location.search, returns us to the mysterious empty dialog situation we had before. Continuing to dig. |
* Create RpInfo before starting the modules. Hard coding the origin and rpName for now * Update IdpAuthentication module to pass RpInfo to the appropriate modules. * Start the check_registration module instead of calling user.waitForUserValidation since it already takes care of error messages.
|
@fmarier or @shane-tomlinson I've removed temporary hacks, console.log, etc. We should be good to merge as discussed. General note: The Goldilocks API breaks the Native implementation, so use http://192.168.186.138:10001/watch.html instead of http://192.168.186.138:10001/ |
|
G R E E N |
| mediator.subscribe("new_user", newUserComplete(self)); | ||
|
|
||
| var rpInfo = bid.Models.RpInfo.create({ | ||
| origin: "http://127.0.0.1:10001", |
fmarier
Nov 7, 2013
Contributor
Did you forget to take these out?
Did you forget to take these out?
|
r+ from me. makes Travis happy. tested by Shane and Austin. |
|
All the man needed was a Guiness at the airport! Thanks! |
This allows the verifier to work-around a Persona bug that has been fixed (mozilla/persona#3982) but not yet deployed. Fixes mozilla#19


Background for pull request: Issue #2497 (comment)
Creating a pull request to try to get some frontend help.
Thanks to @shane-tomlinson for previously reviewing and getting it this far.
Known Issues:
Needs Frontend <3