successCallback_: null,
/**
- * Invoked when GAIA indicates login success and SAML was used. At this
- * point, GAIA cookies are present but the identity of the authenticated
- * user is not known. The embedder of GaiaAuthHost should extract the GAIA
- * cookies from the cookie jar, query GAIA for the authenticated user's
- * e-mail address and invoke GaiaAuthHost.setAuthenticatedUserEmail with the
- * result. The argument is an opaque token that should be passed back to
- * GaiaAuthHost.setAuthenticatedUserEmail.
- * @type {function(number)}
- */
- retrieveAuthenticatedUserEmailCallback_: null,
-
- /**
* Invoked when the auth flow needs a user to confirm his/her passwords.
* This could happen when there are more than one passwords scraped during
* SAML flow. The embedder of GaiaAuthHost should show an UI to collect a
/**
* Invoked when the authentication flow had to be aborted because content
* served over an unencrypted connection was detected.
+ */
insecureContentBlockedCallback_: null,
/**
- * The iframe container.
- * @type {HTMLIFrameElement}
+ * Invoked to display an error message to the user when a GAIA error occurs
+ * during authentication.
+ * @type {function()}
*/
- get frame() {
- return this.frame_;
- },
+ missingGaiaInfoCallback_: null,
/**
- * Sets retrieveAuthenticatedUserEmailCallback_.
+ * Invoked to record that the credentials passing API was used.
* @type {function()}
*/
- set retrieveAuthenticatedUserEmailCallback(callback) {
- this.retrieveAuthenticatedUserEmailCallback_ = callback;
+ samlApiUsedCallback_: null,
+
+ /**
+ * The iframe container.
+ * @type {HTMLIFrameElement}
+ */
+ get frame() {
+ return this.frame_;
},
/**
},
/**
+ * Sets missingGaiaInfoCallback_.
+ * @type {function()}
+ */
+ set missingGaiaInfoCallback(callback) {
+ this.missingGaiaInfoCallback_ = callback;
+ },
+
+ /**
+ * Sets samlApiUsedCallback_.
+ * @type {function()}
+ */
+ set samlApiUsedCallback(callback) {
+ this.samlApiUsedCallback_ = callback;
+ },
+
+ /**
* Loads the auth extension.
* @param {AuthMode} authMode Authorization mode.
* @param {Object} data Parameters for the auth extension. See the auth
},
/**
- * Sends the authenticated user's e-mail address to the auth extension.
- * @param {number} attemptToken The opaque token provided to the
- * retrieveAuthenticatedUserEmailCallback_.
- * @param {string} email The authenticated user's e-mail address.
- */
- setAuthenticatedUserEmail: function(attemptToken, email) {
- var msg = {
- method: 'setAuthenticatedUserEmail',
- attemptToken: attemptToken,
- email: email
- };
- this.frame_.contentWindow.postMessage(msg, AUTH_URL_BASE);
- },
-
- /**
* Invoked to process authentication success.
* @param {Object} credentials Credential object to pass to success
* callback.
}
this.onAuthSuccess_({email: msg.email,
password: msg.password,
+ gaiaId: msg.gaiaId,
useOffline: msg.method == 'offlineLogin',
usingSAML: msg.usingSAML || false,
chooseWhatToSync: msg.chooseWhatToSync,
return;
}
- if (msg.method == 'retrieveAuthenticatedUserEmail') {
- if (this.retrieveAuthenticatedUserEmailCallback_) {
- this.retrieveAuthenticatedUserEmailCallback_(msg.attemptToken,
- msg.apiUsed);
- } else {
- console.error(
- 'GaiaAuthHost: Invalid retrieveAuthenticatedUserEmailCallback_.');
- }
- return;
- }
-
if (msg.method == 'confirmPassword') {
if (this.confirmPasswordCallback_)
this.confirmPasswordCallback_(msg.passwordCount);
return;
}
+ if (msg.method == 'missingGaiaInfo') {
+ if (this.missingGaiaInfoCallback_) {
+ this.missingGaiaInfoCallback_();
+ } else {
+ console.error('GaiaAuthHost: Invalid missingGaiaInfoCallback_.');
+ }
+ return;
+ }
+
+ if (msg.method == 'samlApiUsed') {
+ if (this.samlApiUsedCallback_) {
+ this.samlApiUsedCallback_();
+ } else {
+ console.error('GaiaAuthHost: Invalid samlApiUsedCallback_.');
+ }
+ return;
+ }
+
console.error('Unknown message method=' + msg.method);
}
};