当前位置: 首页>>代码示例>>Java>>正文


Java MultitenantConstants.SUPER_TENANT_DOMAIN_NAME属性代码示例

本文整理汇总了Java中org.wso2.carbon.utils.multitenancy.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java MultitenantConstants.SUPER_TENANT_DOMAIN_NAME属性的具体用法?Java MultitenantConstants.SUPER_TENANT_DOMAIN_NAME怎么用?Java MultitenantConstants.SUPER_TENANT_DOMAIN_NAME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.wso2.carbon.utils.multitenancy.MultitenantConstants的用法示例。


在下文中一共展示了MultitenantConstants.SUPER_TENANT_DOMAIN_NAME属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startTenantFlow

/**
 * Starts the tenant flow for the given tenant domain
 *
 * @param tenantDomain tenant domain
 */
public static void startTenantFlow(String tenantDomain) {
    String tenantDomainParam = tenantDomain;
    int tenantId = MultitenantConstants.SUPER_TENANT_ID;

    if (tenantDomainParam != null && !tenantDomainParam.trim().isEmpty()) {
        try {
            tenantId = FrameworkServiceComponent.getRealmService().getTenantManager()
                    .getTenantId(tenantDomain);
        } catch (UserStoreException e) {
            log.error("Error while getting tenantId from tenantDomain query param", e);
        }
    } else {
        tenantDomainParam = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    }

    PrivilegedCarbonContext.startTenantFlow();
    PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext
            .getThreadLocalCarbonContext();
    carbonContext.setTenantId(tenantId);
    carbonContext.setTenantDomain(tenantDomainParam);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:26,代码来源:FrameworkUtils.java

示例2: getRegistryForAnonymousSession

@SuppressWarnings("deprecation")
private static Registry getRegistryForAnonymousSession(String domainName, String username)
        throws IdentityException {
    try {
        if (domainName == null && username == null) {
            domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
        }
        if (username == null) {
            return AnonymousSessionUtil.getSystemRegistryByDomainName(registryService,
                    realmService, domainName);
        } else {
            return AnonymousSessionUtil.getSystemRegistryByUserName(registryService,
                    realmService, username);
        }
    } catch (CarbonException e) {
        log.error("Error obtaining a registry instance", e);
        throw IdentityException.error("Error obtaining a registry instance", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:19,代码来源:IdentityTenantUtil.java

示例3: getRealmForAnonymousSession

private static UserRealm getRealmForAnonymousSession(String domainName, String username)
        throws IdentityException {

    try {
        if (username != null) {
            return AnonymousSessionUtil.getRealmByUserName(registryService, realmService,
                    username);
        }

        if (domainName == null) {
            domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
        }

        return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService,
                domainName);

    } catch (CarbonException e) {
        throw IdentityException.error("Error Obtaining a realm for user name: " + username + " and " +
                "domain:" + domainName, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:IdentityTenantUtil.java

示例4: doPreDeleteIdP

@Override
public boolean doPreDeleteIdP(String idPName, String tenantDomain) throws IdentityProviderManagementException {

    if (StringUtils.isEmpty(idPName)) {
        throw new IllegalArgumentException("Invalid argument: Identity Provider Name value is empty");
    }

    String loggedInTenant = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    if (IdentityApplicationConstants.RESIDENT_IDP_RESERVED_NAME.equals(idPName)) {
        if (StringUtils.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, tenantDomain)) {
            throw new IdentityProviderManagementException("Cannot delete Resident Identity Provider of Super " +
                    "Tenant");
        } else if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME != loggedInTenant) {
            throw new IdentityProviderManagementException("Tenant user of " + loggedInTenant + " cannot delete " +
                    "Resident Identity Provider of tenant " + tenantDomain);
        } else {
            log.warn("Deleting Resident Identity Provider for tenant " + tenantDomain);
        }
    }

    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:IdPMgtValidationListener.java

示例5: getRegistryService

private RegistryService getRegistryService() throws RegistryException, UserStoreException {
    RealmService realmService = new InMemoryRealmService();
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER);
    BasicDataSource dataSource = new BasicDataSource();
    String connectionUrl = "jdbc:h2:./target/databasetest/CARBON_TEST";
    dataSource.setUrl(connectionUrl);
    dataSource.setDriverClassName("org.h2.Driver");
    JDBCTenantManager jdbcTenantManager = new JDBCTenantManager(dataSource,
            MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    realmService.setTenantManager(jdbcTenantManager);
    RegistryDataHolder.getInstance().setRealmService(realmService);
    DeviceManagementDataHolder.getInstance().setRealmService(realmService);
    InputStream is = this.getClass().getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml");
    RegistryContext context = RegistryContext.getBaseInstance(is, realmService);
    context.setSetup(true);
    return context.getEmbeddedRegistryService();
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:17,代码来源:DeviceAccessAuthorizationServiceTest.java

示例6: getRealmForAnonymousSession

private static UserRealm getRealmForAnonymousSession(String domainName, String username)
        throws IdentityException {
    try {
        if (domainName == null && username == null) {
            domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
        }

        if (username == null) {
            return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService,
                    domainName);
        } else if (username != null) {
            return AnonymousSessionUtil.getRealmByUserName(registryService, realmService,
                    username);
        }
    } catch (CarbonException e) {
        log.error("Error obtaining the realm", e);
        throw IdentityException.error("Error Obtaining a realm", e);
    }
    return null;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:20,代码来源:IdentityTenantUtil.java

示例7: CarbonOAuthTokenRequest

/**
 * Constructs CarbonOAuthTokenRequest from the given HttpServletRequest
 *
 * @param request an instance of HttpServletRequest that represents an OAuth token request
 * @throws OAuthSystemException
 * @throws OAuthProblemException
 */
public CarbonOAuthTokenRequest(HttpServletRequest request) throws OAuthSystemException,
        OAuthProblemException {

    super(request);
    assertion = request.getParameter(OAuth.OAUTH_ASSERTION);
    windows_token = request.getParameter(OAuthConstants.WINDOWS_TOKEN);
    tenantDomain = request.getParameter(MultitenantConstants.TENANT_DOMAIN);
    if (tenantDomain == null) {
        tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    }

    // Store all request parameters
    if (request.getParameterNames() != null) {
        List<RequestParameter> requestParameterList = new ArrayList<RequestParameter>();
        while (request.getParameterNames().hasMoreElements()) {
            String key = request.getParameterNames().nextElement();
            String value = request.getParameter(key);
            requestParameterList.add(new RequestParameter(key, value));
        }
        requestParameters =
                requestParameterList.toArray(new RequestParameter[requestParameterList.size()]);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:30,代码来源:CarbonOAuthTokenRequest.java

示例8: doPreDeleteIdP

@Override
public boolean doPreDeleteIdP(String idPName, String tenantDomain) throws IdentityProviderManagementException {

    if (StringUtils.isEmpty(idPName)) {
        throw new IllegalArgumentException("Invalid argument: Identity Provider Name value is empty");
    }

    String loggedInTenant = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    if (IdentityApplicationConstants.RESIDENT_IDP_RESERVED_NAME.equals(idPName)) {
        if (StringUtils.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, tenantDomain)) {
            throw new IdentityProviderManagementException("Cannot delete Resident Identity Provider of Super " +
                    "Tenant");
        } else if(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME != loggedInTenant){
            throw new IdentityProviderManagementException("Tenant user of " + loggedInTenant + " cannot delete " +
                    "Resident Identity Provider of tenant " + tenantDomain);
        } else {
            log.warn("Deleting Resident Identity Provider for tenant " + tenantDomain);
        }
    }

    return true;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:23,代码来源:IdPMgtValidationListener.java

示例9: addDomainToServiceEpr

/**
 * adding domain for service in registry
 * 
 * @param hostName
 * @param url
 * @throws UrlMapperException
 */
public static void addDomainToServiceEpr(String hostName, String url, String appType) throws UrlMapperException {

	// if the request if from tenant
	String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
	if (url.contains("/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/")) {
		tenantDomain = MultitenantUtils.getTenantDomainFromRequestURL(url);
	}

	if (isServiceURLPattern(url)) {
		url = getServiceEndpoint(url);
	}
	try {
		// add entry to registry with the tenant domain if exist in the uri
		registryManager.addEprToRegistry(hostName, url, tenantDomain, appType);
		URLMappingHolder.getInstance().putUrlMappingForApplication(hostName,
				url);
           log.info("mapping added to service:***********: " + hostName + "******: " + url );
           //adding mapping to cluster message
           VirtualHostClusterUtil.addServiceMappingToCluster(hostName, url);
           addServiceParameter(url);
	} catch (Exception e) {
		log.error("error in adding the domain to the resitry", e);
		throw new UrlMapperException("error in adding the domain to the resitry");
	}
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:32,代码来源:HostUtil.java

示例10: provideTenantDomain

@DataProvider(name = "tenantDomainProvider")
public Object[][] provideTenantDomain() {
    return new Object[][]{
            {
                    null,
                    MultitenantConstants.SUPER_TENANT_DOMAIN_NAME
            },
            {
                    "foo.com",
                    "foo.com"
            }
    };
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:13,代码来源:HttpIdentityRequestFactoryTest.java

示例11: getTenantDomainFromTID

public static String getTenantDomainFromTID(int tenantId) {
    String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    TenantManager tenantManager = DataHolder.getInstance().getRealmService().getTenantManager();
    try {
        tenantDomain = tenantManager.getTenant(tenantId).getDomain();
    } catch (UserStoreException e) {
        log.error("error while getting tenant" ,e);
    }
    return tenantDomain;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:10,代码来源:HostUtil.java

示例12: getTenantFromTopic

/**
 * Extract tenant name from a given topic.
 *
 * @param topic The topic to retrieve tenant name
 * @return Tenant name extracted from topic
 */
public static String getTenantFromTopic(String topic) {
    String tenant = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;

    if (null != topic && topic.contains(AndesConstants.TENANT_SEPARATOR)) {
        tenant = topic.split(AndesConstants.TENANT_SEPARATOR)[0];
    }

    return tenant;
}
 
开发者ID:wso2,项目名称:andes,代码行数:15,代码来源:MQTTUtils.java

示例13: findServices

/**
 * Search the service artifacts stored in the registry and find the set of services
 * that satisfy the conditions stated in the given WS-D probe. If the probe does not
 * impose any restrictions on the result set, all the services in the registry will
 * be returned.
 *
 * @param probe a WS-D probe describing the search criteria
 * @return an array of TargetService instances matching the probe or null
 * @throws Exception if an error occurs while accessing the registry
 */
public static TargetService[] findServices(Probe probe) throws Exception {
    ServiceManager serviceManager = new ServiceManager(getRegistry());
    DiscoveryServiceFilter filter = new DiscoveryServiceFilter(probe);

    // Check whether the inactive services should be skipped when searching
    AxisConfiguration axisConfig;
    String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
    ConfigurationContext mainCfgCtx = ConfigHolder.getInstance().getServerConfigurationContext();
    if (tenantDomain != MultitenantConstants.SUPER_TENANT_DOMAIN_NAME) {
        axisConfig = TenantAxisUtils.getTenantAxisConfiguration(tenantDomain, mainCfgCtx);
    } else {
        axisConfig = mainCfgCtx.getAxisConfiguration();
    }
    
    Parameter parameter = axisConfig.getParameter(DiscoveryConstants.SKIP_INACTIVE_SERVICES);
    filter.setSkipInactiveServices(parameter == null || "true".equals(parameter.getValue()));

    Service[] services = serviceManager.findServices(filter);
    if (services != null && services.length > 0) {
        TargetService[] targetServices = new TargetService[services.length];
        for (int i = 0; i < services.length; i++) {
            targetServices[i] = getTargetService(services[i]);
        }
        return targetServices;
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:37,代码来源:DiscoveryServiceUtils.java

示例14: getTenantDomain

private String getTenantDomain(String username, Message message) {
    String tenantDomain = null;
    // 1. Read "tenant" query parameter from the request URI.
    String query = (String) message.get(Message.QUERY_STRING);
    if (query != null && !query.isEmpty()) {
        int index = query.indexOf("tenant=");
        if (index > -1) {
            query = query.substring(index + 7);
            index = query.indexOf(",");
            if (index > 0) {
                tenantDomain = query.substring(0, index);
            } else {
                tenantDomain = query;
            }
        }
    }

    // 2. If tenantDomain not found, read "X_TENANT" HTTP header.
    if (tenantDomain == null || tenantDomain.isEmpty()) {
        Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
        if (headers != null && !headers.isEmpty()) {
            List<String> headerValues = headers.get("X_TENANT");
            if (headerValues != null && !headerValues.isEmpty()) {
                tenantDomain = headerValues.get(0);
            }
        }
    }

    // 3. If tenantDomain not found, use "username" to resolve the tenant.
    if ((tenantDomain == null || tenantDomain.isEmpty()) && username != null) {
        tenantDomain = MultitenantUtils.getTenantDomain(username);
    }

    // 4. If tenantDomain still not found use supper tenant as default option.
    if (tenantDomain == null) {
        tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    }

    return tenantDomain;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:40,代码来源:AuthenticationHandler.java

示例15: UserRecoveryDTO

public UserRecoveryDTO(String userId) {
    this.userId = userId;
    this.tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    this.tenantId = MultitenantConstants.SUPER_TENANT_ID;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:5,代码来源:UserRecoveryDTO.java


注:本文中的org.wso2.carbon.utils.multitenancy.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。