use of org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService in project identity-api-server by wso2.
the class ServerUserStoreService method getUserStoreManagerProperties.
/**
* Retrieve the meta of user store type.
*
* @param typeId the user store type id.
* @return MetaUserStoreType.
*/
public MetaUserStoreType getUserStoreManagerProperties(String typeId) {
UserStoreConfigService userStoreConfigService = UserStoreConfigServiceHolder.getInstance().getUserStoreConfigService();
Set<String> classNames;
try {
classNames = userStoreConfigService.getAvailableUserStoreClasses();
if (CollectionUtils.isNotEmpty(classNames) && classNames.contains(getUserStoreType(base64URLDecodeId(typeId)))) {
return buildUserStoreMetaResponse(typeId);
} else {
throw handleException(Response.Status.NOT_FOUND, UserStoreConstants.ErrorMessage.ERROR_CODE_NOT_FOUND);
}
} catch (IdentityUserStoreMgtException e) {
UserStoreConstants.ErrorMessage errorEnum = UserStoreConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_USER_STORE;
throw handleIdentityUserStoreMgtException(e, errorEnum);
}
}
use of org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService in project identity-api-server by wso2.
the class ServerUserStoreService method getAttributeMappings.
/**
* Get user store attribute mappings for a given user store typeId.
*
* @param userStoreName String user store name (base64 decoded user store id).
* @param includeIdentityClaimMappings Whether to include claim mapping for identity claims with other userstore
* attributes.
* @return List of user store attribute mappings for the given typeId.
*/
private List<UserStoreAttribute> getAttributeMappings(String userStoreName, boolean includeIdentityClaimMappings) {
UserStoreConfigService userStoreConfigService = UserStoreConfigServiceHolder.getInstance().getUserStoreConfigService();
try {
UserStoreAttributeMappings userStoreAttributeMappings = userStoreConfigService.getUserStoreAttributeMappings();
Map<String, Map<String, UserStoreAttribute>> mapping = userStoreAttributeMappings.getUserStoreAttributeMappings();
Map<String, UserStoreAttribute> userStoreAttributeMap = userStoreAttributeMappings.getDefaultUserStoreAttributeMappings();
if (mapping.containsKey(userStoreName)) {
userStoreAttributeMap = mapping.get(userStoreName);
}
if (!includeIdentityClaimMappings) {
// Remove identity claim mappings by iterating through all the claim mappings.
return excludeIdentityClaims(userStoreAttributeMap);
}
return new ArrayList<>(userStoreAttributeMap.values());
} catch (IdentityUserStoreMgtException e) {
LOG.error("Error occurred while retrieving user store attribute metadata", e);
throw handleException(Response.Status.INTERNAL_SERVER_ERROR, UserStoreConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_USER_STORE_ATTRIBUTE_METADATA);
}
}
Aggregations