lib/middleware/default-organization-resolver.js
function continueWithSubDomainStrategy() {

    if (web.multiTenancy.strategy === 'subdomain') {

      if ((web.domainName === currentHost.domain) && currentHost.subdomain) {
        return resolveOrganizationByNameKey(currentHost.subdomain, function (err, organization) {

          if (err) {
            return next(err);
          }

          if (!organization) {
            return next();
          }

          helpers.assertOrganizationIsMappedToApplication(organization, application, function (err, isMappedToApp) {
            if (err) {
              return next(err);
            }

            if (isMappedToApp) {
              return continueWithOrganization(organization);
            }

            logger.info('The organization "' + organization.name + '" is not mapped to this application, it will not be used.');

            next();
          });
        });
      }

    }

    next();
  }
function continueWithSubDomainStrategy() {

    if (web.multiTenancy.strategy === 'subdomain') {

      if ((web.domainName === currentHost.domain) && currentHost.subdomain) {
        return resolveOrganizationByNameKey(currentHost.subdomain, function (err, organization) {

          if (err) {
            return next(err);
          }

          if (!organization) {
            return next();
          }

          helpers.assertOrganizationIsMappedToApplication(organization, application, function (err, isMappedToApp) {
            if (err) {
              return next(err);
            }

            if (isMappedToApp) {
              return continueWithOrganization(organization);
            }

            logger.info('The organization "' + organization.name + '" is not mapped to this application, it will not be used.');

            next();
          });
        });
      }

    }

    next();
  }
function continueWithSubDomainStrategy ( ) { if ( web . multiTenancy . strategy === 'subdomain' ) { if ( ( web . domainName === currentHost . domain ) && currentHost . subdomain ) { return resolveOrganizationByNameKey ( currentHost . subdomain , function ( err , organization ) { if ( err ) { return next ( err ) ; } if ( ! organization ) { return next ( ) ; } helpers . assertOrganizationIsMappedToApplication ( organization , application , function ( err , isMappedToApp ) { if ( err ) { return next ( err ) ; } if ( isMappedToApp ) { return continueWithOrganization ( organization ) ; } logger . info ( 'The organization "' + organization . name + '" is not mapped to this application, it will not be used.' ) ; next ( ) ; } ) ; } ) ; } } next ( ) ; }
Strategy which tries to resolve an organization from a sub domain. If this step fails then it falls back to resolving an organization from an access token cookie.
Strategy which tries to resolve an organization from a sub domain . If this step fails then it falls back to resolving an organization from an access token cookie .