本文整理汇总了Java中org.wso2.carbon.registry.core.session.UserRegistry类的典型用法代码示例。如果您正苦于以下问题:Java UserRegistry类的具体用法?Java UserRegistry怎么用?Java UserRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserRegistry类属于org.wso2.carbon.registry.core.session包,在下文中一共展示了UserRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getVerifiedChallenges
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* gets no of verified user challenges
*
* @param userDTO bean class that contains user and tenant Information
* @return no of verified challenges
* @throws IdentityException if fails
*/
public static int getVerifiedChallenges(UserDTO userDTO) throws IdentityException {
int noOfChallenges = 0;
try {
UserRegistry registry = IdentityMgtServiceComponent.getRegistryService().
getConfigSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
String identityKeyMgtPath = IdentityMgtConstants.IDENTITY_MANAGEMENT_CHALLENGES +
RegistryConstants.PATH_SEPARATOR + userDTO.getUserId() +
RegistryConstants.PATH_SEPARATOR + userDTO.getUserId();
Resource resource;
if (registry.resourceExists(identityKeyMgtPath)) {
resource = registry.get(identityKeyMgtPath);
String property = resource.getProperty(IdentityMgtConstants.VERIFIED_CHALLENGES);
if (property != null) {
return Integer.parseInt(property);
}
}
} catch (RegistryException e) {
log.error("Error while processing userKey", e);
}
return noOfChallenges;
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:33,代码来源:Utils.java
示例2: testSearchServiceWithNoServices
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public void testSearchServiceWithNoServices() throws Exception {
cleanData();
Resource resource = registry.newResource();
resource.setMediaType(GovernanceConstants.GOVERNANCE_ARTIFACT_CONFIGURATION_MEDIA_TYPE);
resource.setContentStream(this.getClass().getClassLoader().getResourceAsStream("service.rxt"));
registry.put("/service", resource);
GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry);
ServiceManager serviceManager = new ServiceManager(registry);
Service[] allServices = serviceManager.getAllServices();
for (Service s : allServices) {
System.out.println(s.getPath());
}
assertEquals("invalid service count received", 0, allServices.length);
cleanData();
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:20,代码来源:ServiceTest.java
示例3: getServiceProviderConfig
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* Load Service Provider Configurations
*
* @param issuer
* @return SAMLSSOServiceProviderDO
* @throws IdentityException
*/
public static SAMLSSOServiceProviderDO getServiceProviderConfig(String issuer)
throws IdentityException {
try {
SSOServiceProviderConfigManager idPConfigManager =
SSOServiceProviderConfigManager.getInstance();
SAMLSSOServiceProviderDO ssoIdpConfigs = idPConfigManager.getServiceProvider(issuer);
if (ssoIdpConfigs == null) {
IdentityPersistenceManager persistenceManager =
IdentityPersistenceManager.getPersistanceManager();
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
UserRegistry registry =
SAMLSSOUtil.getRegistryService()
.getConfigSystemRegistry(tenantId);
ssoIdpConfigs = persistenceManager.getServiceProvider(registry, issuer);
}
return ssoIdpConfigs;
} catch (Exception e) {
throw IdentityException.error(
SAMLValidatorConstants.ValidationMessage.ERROR_LOADING_SP_CONF,
e);
}
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:30,代码来源:SAMLValidatorUtil.java
示例4: isGetAllowed
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public static boolean isGetAllowed(
String userName, String resourcePath, UserRegistry userRegistry)
throws RegistryException {
boolean putAllowed = false;
UserRealm userRealm = userRegistry.getUserRealm();
try {
if (userRealm.getAuthorizationManager().isUserAuthorized(
userName, resourcePath, ActionConstants.GET)) {
putAllowed = true;
}
} catch (UserStoreException e) {
String msg = "Could not the permission details for the user: " + userName +
" for the resource: " + resourcePath + ". Caused by: " + e.getMessage();
throw new RegistryException(msg);
}
return putAllowed;
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:22,代码来源:UserUtil.java
示例5: getProperty
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public static String getProperty(UserRegistry registry,
String resourcePath, String key) throws RegistryException {
try {
if (registry.resourceExists(resourcePath)) {
Resource resource = registry.get(resourcePath);
if (resource != null) {
String value = resource.getProperty(key);
resource.discard();
return value;
}
}
} catch (RegistryException e) {
String msg = "Failed to get the resource information of resource " + resourcePath +
" for retrieving a property with key : " + key + ". Error :" +
((e.getCause() instanceof SQLException) ?
"" : e.getMessage());
log.error(msg, e);
throw e;
}
return "";
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:27,代码来源:GetPropertyUtil.java
示例6: isRoleProfileExisting
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public boolean isRoleProfileExisting(String role, String sessionId) throws RegistryException {
UserRegistry registry = (UserRegistry) getRootRegistry();
try {
if (registry != null && registry.getUserRealm() != null &&
registry.getUserRealm().getUserStoreManager() != null) {
UserRealm realm = registry.getUserRealm();
boolean isAdmin = false;
String[] userRoles = realm.getUserStoreManager().getRoleListOfUser(
registry.getUserName());
for (String userRole: userRoles) {
if (userRole.equals(realm.getRealmConfiguration().getAdminRoleName())) {
isAdmin = true;
break;
}
}
return Arrays.asList(userRoles).contains(role) || isAdmin;
}
} catch (UserStoreException ignore) {
return false;
}
return false;
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:InfoService.java
示例7: getAllVotingItems
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* Retrieve action set which need votes.
*
* @param aspectName Lifecycle name
* @return Action set which can vote
* @throws org.wso2.carbon.governance.api.exception.GovernanceException throws if the operation failed.
*/
public String[] getAllVotingItems(String aspectName) throws GovernanceException {
Resource artifactResource = getArtifactResource();
ApproveItemBean[] approveItemBeans = GovernanceUtils.
getAllApproveItemBeans(((UserRegistry) registry).getUserName(), artifactResource, this, aspectName);
if (approveItemBeans == null) {
throw new GovernanceException("No voting event found for the lifecycle: " + getLcName() +
" in lifecycle state: " + getLcState() + " of the artifact " +
getQName().getLocalPart());
}
String[] votingItems = new String[approveItemBeans.length];
for (ApproveItemBean approveItemBean : approveItemBeans) {
votingItems[approveItemBean.getOrder()] = approveItemBean.getName();
}
return votingItems;
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:23,代码来源:GovernanceArtifactImpl.java
示例8: setProperty
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* Method to add a property, if there already exist a property with the same name, this
* will add the value to the existing property name. (So please remove the old property with
* the same name before calling this method).
*
* @param path path of the resource.
* @param name property name.
* @param value property value.
*
* @throws RegistryException throws if there is an error.
*/
public void setProperty(String path, String name, String value) throws RegistryException {
if(name != null && name.startsWith("registry.")) {
throw new RegistryException("Property cannot start with the \"registry.\" prefix. " +
"Property name " + name + ". Resource path = " + path);
}
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return;
}
Resource resource = registry.get(path);
if(resource.getProperties().keySet().contains(name)) {
throw new RegistryException("Cannot duplicate property name. Please choose a different name. " +
"Property name " + name + ". Resource path = " + path);
}
resource.addProperty(name, value);
registry.put(resource.getPath(), resource);
resource.discard();
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:33,代码来源:PropertiesAdminService.java
示例9: testBuildSearchCriteriaTaxonomy
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public void testBuildSearchCriteriaTaxonomy() throws Exception {
String val = getStringFromInputStream(this.getClass().getClassLoader().getResourceAsStream("uri.rxt"));
Resource resource = registry.newResource();
resource.setMediaType(GovernanceConstants.GOVERNANCE_ARTIFACT_CONFIGURATION_MEDIA_TYPE);
resource.setContentStream(this.getClass().getClassLoader().getResourceAsStream("uri.rxt"));
registry.put("/uri", resource);
GovernanceArtifactConfiguration governanceArtifactConfiguration =
GovernanceUtils.getGovernanceArtifactConfiguration(val);
GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry);
try {
GovernanceUtils.findGovernanceArtifacts("taxonomy=(SampleURI2 OR SampleURI1)", registry,
governanceArtifactConfiguration.getMediaType());
} catch (GovernanceException e) {
assertEquals("Attribute Search Service not Found", e.getMessage());
assertNull(e.getCause());
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:22,代码来源:TestBuildSearchCriteria.java
示例10: getTopicTree
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public TopicNode getTopicTree() throws EventBrokerException {
try {
UserRegistry userRegistry =
this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
if (!userRegistry.resourceExists(topicStoragePath)) {
userRegistry.put(topicStoragePath, userRegistry.newCollection());
}
Resource root = userRegistry.get(this.topicStoragePath);
TopicNode rootTopic = new TopicNode("/", "/");
buildTopicTree(rootTopic, ((Collection) root).getChildren());
return rootTopic;
} catch (RegistryException e) {
throw new EventBrokerException(e.getMessage(), e);
}
}
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:20,代码来源:TopicManagerServiceImpl.java
示例11: searchTermsInternal
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
private SearchResultsBean searchTermsInternal(String searchQuery, String facetField, Map<String, String> attributes, UserRegistry registry) throws IndexerException, RegistryException {
SearchResultsBean resultsBean = new SearchResultsBean();
SolrClient client = SolrClient.getInstance();
//authenticate required attribute is not used, since we are going to authorize each time and not depends on this flag.
attributes.remove(IndexingConstants.AUTH_REQUIRED);
List<FacetField.Count> results = (searchQuery == null) ? client.facetQuery(registry.getTenantId(), attributes) :
client.facetQuery(searchQuery, facetField, registry.getTenantId());
if (log.isDebugEnabled()) {
log.debug("result for the term search: " + results);
}
List<TermData> termDataList = new ArrayList<>();
for (FacetField.Count count : results) {
termDataList.add(new TermData(count.getName(), count.getCount()));
}
resultsBean.setTermDataList(termDataList.toArray(new TermData[termDataList.size()]));
return resultsBean;
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:ContentBasedSearchService.java
示例12: populate
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public static SearchResultsBean populate(UserRegistry userRegistry, String searchType, String criteria) {
SearchResultsBean searchResultsBean = new SearchResultsBean();
try {
if (searchType.equalsIgnoreCase("Tag")) {
searchResultsBean.setResourceDataList(searchByTags(criteria, userRegistry));
} else {
searchResultsBean.setResourceDataList(searchByContent(criteria, userRegistry));
}
} catch (RegistryException e) {
String msg = "Failed to generate search results. " + e.getMessage();
searchResultsBean.setErrorMessage(msg);
}
return searchResultsBean;
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:SearchResultsBeanPopulator.java
示例13: testStartIndexing
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
@Test
public void testStartIndexing() throws RegistryException {
Long lastAccessTime = Calendar.getInstance().getTimeInMillis();
UserRegistry userRegistry = mock(UserRegistry.class);
ResourceImpl resource = new ResourceImpl();
resource.setPath(lastAccessPath);
resource.setCreatedTime(Calendar.getInstance().getTime());
resource.setProperty("12", String.valueOf(lastAccessTime));
resource.setProperty("-1234", String.valueOf(lastAccessTime));
resource.setProperty("2", String.valueOf(lastAccessTime));
when(userRegistry.get(lastAccessPath)).thenReturn(resource);
doNothing().when(userRegistry).delete(lastAccessPath);
RegistryService registryService = mock(RegistryService.class);
when(userRegistry.resourceExists(lastAccessPath)).thenReturn(true);
when(registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME)).thenReturn(userRegistry);
Utils.setRegistryService(registryService);
IndexingManager manager = IndexingManager.getInstance();
manager.startIndexing();
assertEquals(new Date(lastAccessTime), manager.getLastAccessTime(12));
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:22,代码来源:IndexingManagerTest.java
示例14: RegistrySession
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public RegistrySession(RegistryRepository registryRepository, String workspaceName,
RegistrySimpleCredentials registrySimpleCredentials, UserRegistry userReg, String userID) throws RepositoryException {
this.workspaceName = workspaceName;
this.USER_ID = userID;
this.WORKSPACE_ROOT = RegistryJCRSpecificStandardLoderUtil.getJCRRegistryWorkspaceRoot() + "/" + this.workspaceName + "/";
this.registryRepository = registryRepository;
this.userRegistry = userReg;
createRootNode();
loadJCRSystemConfiguration(userRegistry,WORKSPACE_ROOT);
this.registrySimpleCredentials = registrySimpleCredentials;
this.registryWorkspace = new RegistryWorkspace(registrySimpleCredentials.getUserID(), this);
this.regAccControlMngr = new RegistryAccessControlManager(this);
this.regRetentionMngr = new RegistryRetentionManager(this);
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:17,代码来源:RegistrySession.java
示例15: getTopicTree
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public TopicNode getTopicTree() throws EventBrokerException {
try {
UserRegistry userRegistry =
this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
if (!userRegistry.resourceExists(topicStoragePath)) {
userRegistry.put(topicStoragePath, userRegistry.newCollection());
}
Resource root = userRegistry.get(this.topicStoragePath);
TopicNode rootTopic = new TopicNode("/", "/");
buildTopicTree(rootTopic, (Collection) root, userRegistry);
return rootTopic;
} catch (RegistryException e) {
throw new EventBrokerException(e.getMessage(), e);
}
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:RegistryTopicManager.java
示例16: validateDomainFromSuccessKey
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* validates domain from the successkey
*
* @param governanceSystemRegistry - The governance system registry
* @param domain - tenant domain
* @param successKey - successkey
* @return true, if successfully validated
* @throws RegistryException, if validation failed
*/
public static boolean validateDomainFromSuccessKey(UserRegistry governanceSystemRegistry,
String domain, String successKey)
throws RegistryException {
String domainValidatorInfoPath =
StratosConstants.DOMAIN_VALIDATOR_INFO_PATH + RegistryConstants.PATH_SEPARATOR +
domain + RegistryConstants.PATH_SEPARATOR +
StratosConstants.VALIDATION_KEY_RESOURCE_NAME;
if (governanceSystemRegistry.resourceExists(domainValidatorInfoPath)) {
Resource resource = governanceSystemRegistry.get(domainValidatorInfoPath);
String actualSuccessKey = resource.getProperty("successKey");
if (actualSuccessKey != null && successKey != null &&
actualSuccessKey.trim().equals(successKey.trim())) {
// the domain is correct
return true;
}
}
return false;
}
开发者ID:wso2,项目名称:carbon-commons,代码行数:28,代码来源:CommonUtil.java
示例17: getDecryptedPropertyValue
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* Method to decrypt a property, when key of the property is provided.
*
* @param key key of the property.
* @return decrypted property value.
* @throws RegistryException Throws when an error occurs during decryption.
*/
public static String getDecryptedPropertyValue(String key) throws RegistryException {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
UserRegistry registry = SecurityServiceHolder.getInstance().getRegistryService()
.getConfigSystemRegistry(tenantId);
if (registry.resourceExists(SecureVaultConstants.ENCRYPTED_PROPERTY_STORAGE_PATH)) {
Resource registryResource = registry.get(SecureVaultConstants.ENCRYPTED_PROPERTY_STORAGE_PATH);
String propertyValue = registryResource.getProperty(key);
if (propertyValue != null) {
try {
return doDecrypt(propertyValue);
} catch (CryptoException | UnsupportedEncodingException e) {
throw new RegistryException("Error while decrypting the property value", e);
}
} else {
throw new RegistryException("Property does not exist with key \"" + key + "\" at path " +
SecureVaultConstants.ENCRYPTED_PROPERTY_CONFIG_REGISTRY_PATH);
}
} else {
throw new RegistryException("Collection does not exist at path "
+ SecureVaultConstants.ENCRYPTED_PROPERTY_CONFIG_REGISTRY_PATH);
}
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:31,代码来源:SecureVaultUtil.java
示例18: removeTopic
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean removeTopic(String topicName) throws EventBrokerException {
try {
UserRegistry userRegistry =
this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
String resourcePath = JavaUtil.getResourcePath(topicName, this.topicStoragePath);
removeRoleCreateForLoggedInUser(topicName);
if (userRegistry.resourceExists(resourcePath)) {
userRegistry.delete(resourcePath);
return true;
} else {
return false;
}
} catch (RegistryException e) {
throw new EventBrokerException("Cannot access the config registry", e);
}
}
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:24,代码来源:TopicManagerServiceImpl.java
示例19: validateDomainFromSuccessKey
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
/**
* validates domain from the successkey
*
* @param governanceSystemRegistry - The governance system registry
* @param domain - tenant domain
* @param successKey - successkey
* @return true, if successfully validated
* @throws RegistryException, if validation failed
*/
public static boolean validateDomainFromSuccessKey(UserRegistry governanceSystemRegistry,
String domain, String successKey)
throws RegistryException {
String domainValidatorInfoPath =
StratosConstants.DOMAIN_VALIDATOR_INFO_PATH + RegistryConstants.PATH_SEPARATOR +
domain + RegistryConstants.PATH_SEPARATOR +
StratosConstants.VALIDATION_KEY_RESOURCE_NAME;
if (governanceSystemRegistry.resourceExists(domainValidatorInfoPath)) {
Resource resource = governanceSystemRegistry.get(domainValidatorInfoPath);
String actualSuccessKey = resource.getProperty("successKey");
if (actualSuccessKey != null && successKey != null &&
actualSuccessKey.trim().equals(successKey.trim())) {
// the domain is correct
return true;
}
}
return false;
}
开发者ID:apache,项目名称:stratos,代码行数:28,代码来源:CommonUtil.java
示例20: isCloudServiceActive
import org.wso2.carbon.registry.core.session.UserRegistry; //导入依赖的package包/类
public static boolean isCloudServiceActive(String cloudServiceName,
int tenantId, UserRegistry govRegistry)
throws Exception {
// The cloud manager is always active
if (StratosConstants.CLOUD_MANAGER_SERVICE.equals(cloudServiceName)) {
return true;
}
String cloudServiceInfoPath = StratosConstants.CLOUD_SERVICE_INFO_STORE_PATH +
RegistryConstants.PATH_SEPARATOR + tenantId +
RegistryConstants.PATH_SEPARATOR + cloudServiceName;
Resource cloudServiceInfoResource;
if (govRegistry.resourceExists(cloudServiceInfoPath)) {
cloudServiceInfoResource = govRegistry.get(cloudServiceInfoPath);
String isActiveStr =
cloudServiceInfoResource.getProperty(
StratosConstants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY);
return "true".equals(isActiveStr);
}
return false;
}
开发者ID:wso2,项目名称:carbon-commons,代码行数:22,代码来源:CloudServicesUtil.java
注:本文中的org.wso2.carbon.registry.core.session.UserRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论