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


Java MultitenantConstants.INVALID_TENANT_ID属性代码示例

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


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

示例1: addToCache

/**
 * Add a cache entry.
 *
 * @param key   Key which cache entry is indexed.
 * @param entry Actual object where cache entry is placed.
 */
public void addToCache(AuthenticationContextCacheKey key, AuthenticationContextCacheEntry entry) {
    super.addToCache(key, entry);
    if (isTemporarySessionDataPersistEnabled) {
        int tenantId = MultitenantConstants.INVALID_TENANT_ID;
        String tenantDomain = entry.getContext().getTenantDomain();
        if (tenantDomain != null) {
            tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
        }

        if (entry.getContext() != null && entry.getContext().getProperties() != null) {
            Iterator it = entry.getContext().getProperties().entrySet().iterator();
            while (it.hasNext())
            {
                Map.Entry<String, Object> item =  (Map.Entry<String, Object>) it.next();
                if (!(item.getValue() instanceof Serializable)) {
                    it.remove();
                }
            }
            SessionDataStore.getInstance().storeSessionData(key.getContextId(), AUTHENTICATION_CONTEXT_CACHE_NAME,
                    entry, tenantId);
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:29,代码来源:AuthenticationContextCache.java

示例2: isUserStoreCaseSensitive

/**
 * Check the case sensitivity of the user store.
 *
 * @param userStoreDomain user store domain
 * @param tenantId        tenant id of the user store
 * @return
 */
public static boolean isUserStoreCaseSensitive(String userStoreDomain, int tenantId) {

    boolean isUsernameCaseSensitive = true;
    if (tenantId == MultitenantConstants.INVALID_TENANT_ID) {
        //this is to handle federated scenarios
        return true;
    }
    try {
        org.wso2.carbon.user.core.UserStoreManager userStoreManager = (org.wso2.carbon.user.core
                .UserStoreManager) IdentityTenantUtil.getRealmService()
                .getTenantUserRealm(tenantId).getUserStoreManager();
        org.wso2.carbon.user.core.UserStoreManager userAvailableUserStoreManager = userStoreManager
                .getSecondaryUserStoreManager(userStoreDomain);
        return isUserStoreCaseSensitive(userAvailableUserStoreManager);
    } catch (UserStoreException e) {
        if (log.isDebugEnabled()) {
            log.debug("Error while reading user store property CaseInsensitiveUsername. Considering as case " +
                    "sensitive.");
        }
    }
    return isUsernameCaseSensitive;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:29,代码来源:IdentityUtil.java

示例3: isUserStoreCaseSensitive

/**
 * Check the case sensitivity of the user store.
 *
 * @param userStoreDomain user store domain
 * @param tenantId        tenant id of the user store
 * @return
 */
public static boolean isUserStoreCaseSensitive(String userStoreDomain, int tenantId) {

    boolean isUsernameCaseSensitive = true;
    if (tenantId == MultitenantConstants.INVALID_TENANT_ID){
        //this is to handle federated scenarios
        return true;
    }
    try {
        org.wso2.carbon.user.core.UserStoreManager userStoreManager = (org.wso2.carbon.user.core
                .UserStoreManager) IdentityTenantUtil.getRealmService()
                .getTenantUserRealm(tenantId).getUserStoreManager();
        org.wso2.carbon.user.core.UserStoreManager userAvailableUserStoreManager = userStoreManager
                .getSecondaryUserStoreManager(userStoreDomain);
        return isUserStoreCaseSensitive(userAvailableUserStoreManager);
    } catch (UserStoreException e) {
        if (log.isDebugEnabled()) {
            log.debug("Error while reading user store property CaseInsensitiveUsername. Considering as case " +
                    "sensitive.");
        }
    }
    return isUsernameCaseSensitive;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:29,代码来源:IdentityUtil.java

示例4: getMultiAttributeSeparator

private String getMultiAttributeSeparator(String authenticatedUser, int tenantId) {
    String claimSeparator = null;
    String userDomain = IdentityUtil.extractDomainFromName(authenticatedUser);

    try {
        RealmConfiguration realmConfiguration = null;
        RealmService realmService = OAuthComponentServiceHolder.getRealmService();

        if (realmService != null && tenantId != MultitenantConstants.INVALID_TENANT_ID) {
            UserStoreManager userStoreManager = (UserStoreManager) realmService.getTenantUserRealm(tenantId)
                    .getUserStoreManager();
            realmConfiguration = userStoreManager.getSecondaryUserStoreManager(userDomain).getRealmConfiguration();
        }

        if (realmConfiguration != null) {
            claimSeparator = realmConfiguration.getUserStoreProperty(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
            if (claimSeparator != null && !claimSeparator.trim().isEmpty()) {
                return claimSeparator;
            }
        }
    } catch (UserStoreException e) {
        log.error("Error occurred while getting the realm configuration, User store properties might not be " +
                  "returned", e);
    }
    return null;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:26,代码来源:JWTTokenGenerator.java

示例5: addToCache

public void addToCache(String key, IdentityMessageContext context) {
    super.addToCache(key, context);
    if (enableRequestScopeCache) {
        int tenantId = MultitenantConstants.INVALID_TENANT_ID;
        String tenantDomain = context.getRequest().getTenantDomain();
        if (tenantDomain != null) {
            tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
        }
        SessionDataStore.getInstance().storeSessionData(key, INBOUND_CONTEXT_CACHE_NAME, context, tenantId);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:11,代码来源:IdentityContextCache.java

示例6: addToCache

/**
 * Add a cache entry.
 *
 * @param key   Key which cache entry is indexed.
 * @param entry Actual object where cache entry is placed.
 */
public void addToCache(AuthenticationResultCacheKey key, AuthenticationResultCacheEntry entry) {
    super.addToCache(key, entry);
    if (isTemporarySessionDataPersistEnabled) {
        int tenantId = MultitenantConstants.INVALID_TENANT_ID;
        if (entry.getResult() != null && entry.getResult().getSubject() != null) {
            String tenantDomain = entry.getResult().getSubject().getTenantDomain();
            if (tenantDomain != null) {
                tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
            }
        }
        SessionDataStore.getInstance().storeSessionData(key.getResultId(), CACHE_NAME, entry, tenantId);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:19,代码来源:AuthenticationResultCache.java

示例7: addToCache

/**
 * Add a cache entry.
 *
 * @param key   Key which cache entry is indexed.
 * @param entry Actual object where cache entry is placed.
 */
public void addToCache(AuthenticationRequestCacheKey key, AuthenticationRequestCacheEntry entry){
    super.addToCache(key,entry);
    if(isTemporarySessionDataPersistEnabled){
        int tenantId = MultitenantConstants.INVALID_TENANT_ID;
        String tenantDomain = entry.getAuthenticationRequest().getTenantDomain();
        if (tenantDomain != null) {
            tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
        }
        SessionDataStore.getInstance().storeSessionData(key.getResultId(), AUTHENTICATION_REQUEST_CACHE_NAME,
                entry, tenantId);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:18,代码来源:AuthenticationRequestCache.java

示例8: addToCache

public void addToCache(InboundAuthenticationContextCacheKey key, InboundAuthenticationContextCacheEntry entry) {
    super.addToCache(key, entry);
    if (enableRequestScopeCache) {
        int tenantId = MultitenantConstants.INVALID_TENANT_ID;
        String tenantDomain = entry.getInboundAuthenticationContext().getTenantDomain();
        if (tenantDomain != null) {
            tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
        }
        SessionDataStore.getInstance().storeSessionData(key.getResultId(),
                INBOUND_AUTHENTICATION_CONTEXT_CACHE_NAME, entry, tenantId);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:12,代码来源:InboundAuthenticationContextCache.java

示例9: addToCache

/**
 * Add a cache entry.
 *
 * @param key   Key which cache entry is indexed.
 * @param entry Actual object where cache entry is placed.
 */
public void addToCache(AuthenticationContextCacheKey key, AuthenticationContextCacheEntry entry) {
    super.addToCache(key, entry);
    if (isTemporarySessionDataPersistEnabled) {
        int tenantId = MultitenantConstants.INVALID_TENANT_ID;
        String tenantDomain = entry.getContext().getTenantDomain();
        if (tenantDomain != null) {
            tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
        }
        SessionDataStore.getInstance().storeSessionData(key.getContextId(), AUTHENTICATION_CONTEXT_CACHE_NAME,
                entry, tenantId);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:18,代码来源:AuthenticationContextCache.java


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