|
@@ -1,3 +1,10 @@
|
|
|
+
|
|
|
+Meteor._debug("Loading lib/drupalsso");
|
|
|
+
|
|
|
+if (Meteor.isClient) {
|
|
|
+ var stream = new Meteor.Stream(CHANNEL_NAME);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* The SSO constructor.
|
|
|
*
|
|
@@ -21,6 +28,7 @@ DrupalSSO = function () {
|
|
|
// Work around "this" interpretation in local scope methods.
|
|
|
var that = this;
|
|
|
|
|
|
+
|
|
|
this.settings = {
|
|
|
client: {}
|
|
|
};
|
|
@@ -61,6 +69,13 @@ DrupalSSO = function () {
|
|
|
* @param {string} cookies
|
|
|
*/
|
|
|
this.updateUser = function (cookies) {
|
|
|
+ if (Meteor.isClient) {
|
|
|
+ Meteor._debug('Setting up once on ' + CHANNEL_NAME);
|
|
|
+ // Just listen once, since we rearm immediately.
|
|
|
+ stream.once(EVENT_NAME, function (e) {
|
|
|
+ that.updateUser(document.cookie);
|
|
|
+ });
|
|
|
+ }
|
|
|
Meteor.call('drupal-sso.whoami', cookies, function (err, res) {
|
|
|
if (err) {
|
|
|
throw new Meteor.Error('whoami', err);
|