Index: chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
index 67e163d28b7dbc0b2e052e83dfb1fc310d130c6a..09475949c27c75d1ebe2b82a260b1a1717d8533f 100644 |
--- a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
+++ b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js |
@@ -16,6 +16,7 @@ |
'showStep', |
'showError', |
'showWorking', |
+ 'setAuthenticatedUserEmail', |
'doReload', |
], |
@@ -205,6 +206,24 @@ |
this.showStep(STEP_WORKING); |
}, |
+ /** |
+ * Invoked when the authenticated user's e-mail address has been retrieved. |
+ * This completes SAML authentication. |
+ * @param {number} attemptToken An opaque token used to correlate this |
+ * method invocation with the corresponding request to retrieve the |
+ * user's e-mail address. |
+ * @param {string} email The authenticated user's e-mail address. |
+ */ |
+ setAuthenticatedUserEmail: function(attemptToken, email) { |
+ if (this.attemptToken_ != attemptToken) |
+ return; |
+ |
+ if (!email) |
+ this.showError(loadTimeData.getString('fatalEnrollmentError'), false); |
+ else |
+ chrome.send('oauthEnrollCompleteLogin', [email]); |
+ }, |
+ |
doReload: function() { |
$('oauth-enroll-signin-frame').contentWindow.location.href = |
this.signInUrl_; |
@@ -270,8 +289,18 @@ |
var msg = m.data; |
if (msg.method == 'completeLogin') { |
- // A user has successfully authenticated via regular GAIA or SAML. |
+ // A user has successfully authenticated via regular GAIA. |
chrome.send('oauthEnrollCompleteLogin', [msg.email]); |
+ } |
+ |
+ if (msg.method == 'retrieveAuthenticatedUserEmail') { |
+ // A user has successfully authenticated via SAML. However, the user's |
+ // identity is not known. Instead of reporting success immediately, |
+ // retrieve the user's e-mail address first. |
+ this.attemptToken_ = msg.attemptToken; |
+ this.showWorking(null); |
+ chrome.send('oauthEnrollRetrieveAuthenticatedUserEmail', |
+ [msg.attemptToken]); |
} |
if (msg.method == 'authPageLoaded' && this.currentStep_ == STEP_SIGNIN) { |
@@ -289,12 +318,6 @@ |
loadTimeData.getStringF('insecureURLEnrollmentError', msg.url), |
false); |
} |
- |
- if (msg.method == 'missingGaiaInfo') { |
- this.showError( |
- loadTimeData.getString('fatalEnrollmentError'), |
- false); |
- } |
} |
}; |
}); |