var configs = require('/config/sso.js').config();

var server = require('/modules/server.js');
server.init(configs);

var user = require('/modules/user.js');
user.init(configs);

var event = require('event');


var STORE_CONFIG_PATH = '/_system/config/sso/configs/sso.json';

var server = require('/modules/server.js');
server.init(configs);

var user = require('/modules/user.js');
user.init(configs);

var log = new Log();

event.on('tenantCreate', function (tenantId) {
    var carbon = require('carbon'),
        system = server.systemRegistry(tenantId);
    system.put(STORE_CONFIG_PATH, {
        content: JSON.stringify({
            "permissions": configs.permissions
        }),
        mediaType: 'application/json'
    });
});

event.on('tenantLoad', function (tenantId) {
    var carbon = require('carbon'),
        config = server.configs(tenantId),
        reg = server.systemRegistry(tenantId),
        um = server.userManager(tenantId);

    //check whether tenantCreate has been called
    if (!reg.exists(STORE_CONFIG_PATH)) {
    }
    event.emit('tenantCreate', tenantId);

    config[user.USER_OPTIONS] = {
        "permissions": configs.permissions
    };
});

@@ -305,32 +305,90 @@
 es/server.js');%0A
+var ssoTenantConfig = require('/config/sso-tenant.json');%0A
 server.init(conf
@@ -385,33 +385,32 @@
 .init(configs);%0A
-%0A
 var user = requi
@@ -425,32 +425,68 @@
 ules/user.js');%0A
+var storeModule = require('store');%0A
 user.init(config
@@ -508,24 +508,90 @@
 new Log();%0A%0A
+storeModule.server.init(configs);%0AstoreModule.user.init(configs);%0A
 event.on('te
@@ -783,66 +783,23 @@
 ify(
-%7B%0A            %22permissions%22: configs.permissions%0A        %7D
+ssoTenantConfig
 ),%0A 
@@ -1287,12 +1287,115 @@
 %0A    %7D;%0A
-
 %7D);%0A
+%0A//Cause the super tenant to be load%0Avar SUPER_TENANT = -1234;%0Aevent.emit('tenantLoad', SUPER_TENANT);%0A

Add initializaion of user and server module,put sso tenant configuration into registry,Trigger super tenant TenantLoad event