本文整理汇总了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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}