本文整理汇总了Java中org.wso2.carbon.base.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.base.MultitenantConstants
的用法示例。
在下文中一共展示了MultitenantConstants.SUPER_TENANT_DOMAIN_NAME属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTenantDomain
private String getTenantDomain(HttpServletRequest request) throws FrameworkException {
String tenantDomain = request.getParameter(FrameworkConstants.RequestParams.TENANT_DOMAIN);
if (tenantDomain == null || tenantDomain.isEmpty() || "null".equals(tenantDomain)) {
String tenantId = request.getParameter(FrameworkConstants.RequestParams.TENANT_ID);
if (tenantId != null && !"-1234".equals(tenantId)) {
try {
Tenant tenant = FrameworkServiceComponent.getRealmService().getTenantManager()
.getTenant(Integer.parseInt(tenantId));
if (tenant != null) {
tenantDomain = tenant.getDomain();
}
} catch (Exception e) {
throw new FrameworkException(e.getMessage(), e);
}
} else {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
}
return tenantDomain;
}
示例2: testDeviceSchemaInitializer
@Test(description = "This testcase tests the functionality of the DeviceSchemaInitializer")
public void testDeviceSchemaInitializer()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
String deviceType = "sample2";
String expectedDBLocation =
System.getProperty("carbon.home") + File.separator + "dbscripts" + File.separator + "cdm"
+ File.separator + "plugins" + File.separator + deviceType + File.separator + "h2.sql";
DeviceSchemaInitializer deviceSchemaInitializer = new DeviceSchemaInitializer(null, deviceType,
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
Method getDbScriptLocation = DeviceSchemaInitializer.class
.getDeclaredMethod("getDbScriptLocation", String.class);
getDbScriptLocation.setAccessible(true);
String dbLocation = (String) getDbScriptLocation.invoke(deviceSchemaInitializer, "h2");
Assert.assertEquals(dbLocation, expectedDBLocation,
"Expected DB location for the device type is not retrieved");
}
示例3: testWithDefectivePlatformConfiguration
@Test(description = "This test case tests the behaviour of the DeviceTypeManager creation when having a "
+ "defective platform configuration ", expectedExceptions = {DeviceTypeDeployerPayloadException.class},
expectedExceptionsMessageRegExp = "Error occurred while getting default platform configuration for the "
+ "device type wrong *")
public void testWithDefectivePlatformConfiguration() {
DeviceTypeConfigIdentifier wrongDeviceTypeConfigIdentifier = new DeviceTypeConfigIdentifier("wrong",
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
new DeviceTypeManager(wrongDeviceTypeConfigIdentifier, androidDeviceTypeConfiguration);
}
示例4: testDeviceTypeConfigIdentifier
@Test(description = "This test case tests the DeviceTypeConfigIdentifier equals method")
public void testDeviceTypeConfigIdentifier() {
DeviceTypeConfigIdentifier deviceTypeConfigIdentifier = new DeviceTypeConfigIdentifier("sample",
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
DeviceTypeConfigIdentifier clonedDeviceTypeConfigIdentifier = new DeviceTypeConfigIdentifier("sample",
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
Assert.assertTrue(deviceTypeConfigIdentifier.equals(clonedDeviceTypeConfigIdentifier),
"Clone device type config identifier gives wrong results for equals check.");
Assert.assertFalse(deviceTypeConfigIdentifier.equals(null),
"Device Type config identifier object comparison gives wrong results.");
}
示例5: getPrivateKey
private Key getPrivateKey(String tenantDomain, int tenantId) throws IdentityOAuth2Exception {
if (tenantDomain == null) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (tenantId == 0) {
tenantId = OAuth2Util.getTenantId(tenantDomain);
}
Key privateKey = null;
if (!(privateKeys.containsKey(tenantId))) {
// get tenant's key store manager
KeyStoreManager tenantKSM = KeyStoreManager.getInstance(tenantId);
if (!tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
// derive key store name
String ksName = tenantDomain.trim().replace(".", "-");
String jksName = ksName + ".jks";
// obtain private key
privateKey = tenantKSM.getPrivateKey(jksName, tenantDomain);
} else {
try {
privateKey = tenantKSM.getDefaultPrivateKey();
} catch (Exception e) {
log.error("Error while obtaining private key for super tenant", e);
}
}
if (privateKey != null) {
privateKeys.put(tenantId, privateKey);
}
} else {
privateKey = privateKeys.get(tenantId);
}
return privateKey;
}
示例6: getCertificate
private Certificate getCertificate(String tenantDomain, int tenantId) throws Exception {
if (tenantDomain == null) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (tenantId == 0) {
tenantId = OAuth2Util.getTenantId(tenantDomain);
}
Certificate publicCert = null;
if (!(publicCerts.containsKey(tenantId))) {
// get tenant's key store manager
KeyStoreManager tenantKSM = KeyStoreManager.getInstance(tenantId);
KeyStore keyStore = null;
if (!tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
// derive key store name
String ksName = tenantDomain.trim().replace(".", "-");
String jksName = ksName + ".jks";
keyStore = tenantKSM.getKeyStore(jksName);
publicCert = keyStore.getCertificate(tenantDomain);
} else {
publicCert = tenantKSM.getDefaultPrimaryCertificate();
}
if (publicCert != null) {
publicCerts.put(tenantId, publicCert);
}
} else {
publicCert = publicCerts.get(tenantId);
}
return publicCert;
}
示例7: TenantManager
private TenantManager() {
this.tenantIdTenantMap = new HashMap<Integer, Tenant>();
this.tenantDomainTenantMap = new HashMap<String, Tenant>();
Tenant superTenant = new Tenant(MultitenantConstants.SUPER_TENANT_ID,
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
this.tenantIdTenantMap.put(MultitenantConstants.SUPER_TENANT_ID, superTenant);
this.tenantDomainTenantMap.put(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, superTenant);
}
示例8: getDomain
@Override
public String getDomain(int i) throws org.wso2.carbon.user.api.UserStoreException {
return MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
示例9: claimsGet
/**
*
* return the recovery supported claims in the given tenant.
* @param tenantDomain tenant domain. Default `carbon.super` (optional)
* @return List<Claim>
* @throws ApiException if fails to make API call
*/
public List<Claim> claimsGet(String tenantDomain) throws ApiException {
Object localVarPostBody = null;
if (StringUtils.isBlank(tenantDomain)) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + tenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/claims".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "tenant-domain", tenantDomain));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<List<Claim>> localVarReturnType = new GenericType<List<Claim>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
示例10: recoverUsernamePost
/**
*
* This API can be used to recover forgot username.
* @param claim User answers for recovery claims. (required)
* @param tenantDomain Tenant Domain which user belongs. Default `carbon.super` (optional)
* @param notify If notify=true then, notifications will be internally managed. (optional)
* @throws ApiException if fails to make API call
*/
public void recoverUsernamePost(List<UserClaim> claim, String tenantDomain, Boolean notify) throws ApiException {
Object localVarPostBody = claim;
// verify the required parameter 'claim' is set
if (claim == null) {
throw new ApiException(400, "Missing the required parameter 'claim' when calling recoverUsernamePost");
}
if (StringUtils.isBlank(tenantDomain)) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + tenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/recover-username/".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "tenant-domain", tenantDomain));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "notify", notify));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
示例11: securityQuestionGet
/**
* This API is used to initiate password recovery using user challenge questions. Response will be a random challenge question with a confirmation key.
*
* @param username username of the user (required)
* @param realm `User Store Domain` which user belongs. If not specified, it will be `PRIMARY` domain. (optional)
* @param tenantDomain `Tenant Domain` which user belongs. If not specified, it will be `carbon.super` domain. (optional)
* @return InitiateQuestionResponse
* @throws ApiException if fails to make API call
*/
public InitiateQuestionResponse securityQuestionGet(String username, String realm, String tenantDomain) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling securityQuestionGet");
}
if (StringUtils.isBlank(tenantDomain)) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + tenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/security-question".replaceAll("\\{format\\}", "json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "realm", realm));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "tenant-domain", tenantDomain));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{};
GenericType<InitiateQuestionResponse> localVarReturnType = new GenericType<InitiateQuestionResponse>() {
};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
示例12: securityQuestionsGet
/**
* This API is used to initiate password recovery using user challenge questions at once. Response will be a random challenge questions with a confirmation key.
*
* @param username username of the user (required)
* @param realm `User Store Domain` which user belongs. If not specified, it will be `PRIMARY` domain. (optional)
* @param tenantDomain `Tenant Domain` which user belongs. If not specified, it will be `carbon.super` domain. (optional)
* @return InitiateAllQuestionResponse
* @throws ApiException if fails to make API call
*/
public InitiateAllQuestionResponse securityQuestionsGet(String username, String realm, String tenantDomain) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling securityQuestionsGet");
}
if (StringUtils.isBlank(tenantDomain)) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + tenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/security-questions".replaceAll("\\{format\\}", "json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "realm", realm));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "tenant-domain", tenantDomain));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{};
GenericType<InitiateAllQuestionResponse> localVarReturnType = new GenericType<InitiateAllQuestionResponse>() {
};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
示例13: recoverPasswordPost
/**
* This API is used to send password recovery confirmation over defined channels like email/sms
*
* @param recoveryInitiatingRequest It can be sent optional property parameters over email based on email template. (required)
* @param type Notification Type (optional)
* @param notify If notify=true then, notifications will be internally managed. (optional)
* @return String
* @throws ApiException if fails to make API call
*/
public String recoverPasswordPost(RecoveryInitiatingRequest recoveryInitiatingRequest, String type, Boolean notify) throws ApiException {
Object localVarPostBody = recoveryInitiatingRequest;
// verify the required parameter 'recoveryInitiatingRequest' is set
if (recoveryInitiatingRequest == null) {
throw new ApiException(400, "Missing the required parameter 'recoveryInitiatingRequest' when calling recoverPasswordPost");
}
String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
if (StringUtils.isNotBlank(recoveryInitiatingRequest.getUser().getTenantDomain())) {
tenantDomain = recoveryInitiatingRequest.getUser().getTenantDomain();
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + tenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/recover-password".replaceAll("\\{format\\}", "json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "type", type));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "notify", notify));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{};
GenericType<String> localVarReturnType = new GenericType<String>() {
};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
示例14: recoverUsernamePost
/**
* This API can be used to recover forgot username.
*
* @param claim User answers for recovery claims. (required)
* @param tenantDomain Tenant Domain which user belongs. Default `carbon.super` (optional)
* @param notify If notify=true then, notifications will be internally managed. (optional)
* @throws ApiException if fails to make API call
*/
public void recoverUsernamePost(List<UserClaim> claim, String tenantDomain, Boolean notify) throws ApiException {
Object localVarPostBody = claim;
// verify the required parameter 'claim' is set
if (claim == null) {
throw new ApiException(400, "Missing the required parameter 'claim' when calling recoverUsernamePost");
}
if (StringUtils.isBlank(tenantDomain)) {
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + tenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/recover-username/".replaceAll("\\{format\\}", "json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "tenant-domain", tenantDomain));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "notify", notify));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{};
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
示例15: setPasswordPost
/**
* This API will be used to reset user password using the confirmatin key recieved through recovery process. Need to input `key` and the new `password`.
*
* @param resetPasswordRequest key, password and optional metadata properties (required)
* @throws ApiException if fails to make API call
*/
public void setPasswordPost(ResetPasswordRequest resetPasswordRequest) throws ApiException {
Object localVarPostBody = resetPasswordRequest;
// verify the required parameter 'resetPasswordRequest' is set
if (resetPasswordRequest == null) {
throw new ApiException(400, "Missing the required parameter 'resetPasswordRequest' when calling setPasswordPost");
}
String userTenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
List<Property> properties = resetPasswordRequest.getProperties();
for(Property property : properties){
if(StringUtils.equalsIgnoreCase(IdentityManagementEndpointConstants.TENANT_DOMAIN, property.getKey())){
userTenantDomain = property.getValue();
properties.remove(property);
break;
}
}
if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(userTenantDomain)) {
basePath = IdentityManagementServiceUtil.getInstance().getServiceContextURL()
.replace(IdentityManagementEndpointConstants.UserInfoRecovery.SERVICE_CONTEXT_URL_DOMAIN,
"t/" + userTenantDomain + "/api/identity/recovery/v0.9");
}
apiClient.setBasePath(basePath);
// create path and map variables
String localVarPath = "/set-password".replaceAll("\\{format\\}", "json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{};
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}