本文整理汇总了Java中org.wso2.carbon.user.core.UserCoreConstants.DOMAIN_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java UserCoreConstants.DOMAIN_SEPARATOR属性的具体用法?Java UserCoreConstants.DOMAIN_SEPARATOR怎么用?Java UserCoreConstants.DOMAIN_SEPARATOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.wso2.carbon.user.core.UserCoreConstants
的用法示例。
在下文中一共展示了UserCoreConstants.DOMAIN_SEPARATOR属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUsernames
@DataProvider(name = "usernameProvider")
public Object[][] getUsernames() {
String userStoreDomainAppendedName = USER_STORE_NAME + UserCoreConstants.DOMAIN_SEPARATOR + USER_NAME;
return new Object[][]{
{
// username already has a domain appended
userStoreDomainAppendedName, "WSO2.COM", userStoreDomainAppendedName
},
{
// setting domain from threadlocal
USER_NAME, USER_STORE_NAME, userStoreDomainAppendedName
},
{
// username doesn't have domain, thread local domain is empty too
USER_NAME, null, USER_NAME
},
{
// username doesn't have domain, thread local domain is empty too
USER_NAME, "", USER_NAME
},
};
}
示例2: addDomainToName
/**
* Appends domain name to the user/role name
*
* @param name user/role name
* @param domainName domain name
* @return application name with domain name
*/
public static String addDomainToName(String name, String domainName) {
if (domainName != null && name != null && !name.contains(UserCoreConstants.DOMAIN_SEPARATOR)) {
if (!UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME.equalsIgnoreCase(domainName)) {
if (UserCoreConstants.INTERNAL_DOMAIN.equalsIgnoreCase(domainName) ||
"Workflow".equalsIgnoreCase(domainName) || "Application".equalsIgnoreCase(domainName)) {
name = domainName + UserCoreConstants.DOMAIN_SEPARATOR + name;
} else {
name = domainName.toUpperCase() + UserCoreConstants.DOMAIN_SEPARATOR + name;
}
}
}
return name;
}
示例3: addDomainToName
/**
* Appends domain name to the user/role name
*
* @param name user/role name
* @param domainName domain name
* @return application name with domain name
*/
public static String addDomainToName(String name, String domainName) {
if (domainName != null && name != null && name.indexOf(UserCoreConstants.DOMAIN_SEPARATOR) < 0) {
if (!UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME.equalsIgnoreCase(domainName)) {
if (UserCoreConstants.INTERNAL_DOMAIN.equalsIgnoreCase(domainName) ||
"Workflow".equalsIgnoreCase(domainName) || "Application".equalsIgnoreCase(domainName)) {
name = domainName + UserCoreConstants.DOMAIN_SEPARATOR + name;
} else {
name = domainName.toUpperCase() + UserCoreConstants.DOMAIN_SEPARATOR + name;
}
}
}
return name;
}
示例4: getAppRoleName
private static String getAppRoleName(String applicationName) {
return ApplicationConstants.APPLICATION_DOMAIN + UserCoreConstants.DOMAIN_SEPARATOR + applicationName;
}
示例5: addUser
private void addUser(String userName, String password, Map<String, String> claimList,
String profileName, UserRealm realm) throws IdentityException {
UserStoreManager admin = null;
Permission permission = null;
try {
// get config from tenant registry
TenantRegistrationConfig tenantConfig = getTenantSignUpConfig(realm.getUserStoreManager().getTenantId());
// set tenant config specific sign up domain
if (tenantConfig != null && !"".equals(tenantConfig.getSignUpDomain())) {
int index = userName.indexOf(UserCoreConstants.DOMAIN_SEPARATOR);
if (index > 0) {
userName = tenantConfig.getSignUpDomain().toUpperCase() + UserCoreConstants.DOMAIN_SEPARATOR
+ userName.substring(index + 1);
} else {
userName = tenantConfig.getSignUpDomain().toUpperCase() + UserCoreConstants.DOMAIN_SEPARATOR
+ userName;
}
}
// add user to the relevant user store
admin = realm.getUserStoreManager();
if (!isUserNameWithAllowedDomainName(userName, realm)) {
throw IdentityException.error("Domain does not permit self registration");
}
// add user
admin.addUser(userName, password, null, claimList, profileName);
// after adding the user, assign specif roles
List<String> roleNamesArr = getRoleName(userName, tenantConfig);
if (claimList.get(SelfRegistrationConstants.SIGN_UP_ROLE_CLAIM_URI) != null) {
// check is a user role is specified as a claim by the client, if so add it to the roles list
if (tenantConfig != null) {
roleNamesArr.add(tenantConfig.getSignUpDomain().toUpperCase()
+ UserCoreConstants.DOMAIN_SEPARATOR
+ claimList.get(SelfRegistrationConstants.SIGN_UP_ROLE_CLAIM_URI));
} else {
roleNamesArr.add(UserCoreConstants.INTERNAL_DOMAIN
+ UserCoreConstants.DOMAIN_SEPARATOR
+ claimList.get(SelfRegistrationConstants.SIGN_UP_ROLE_CLAIM_URI));
}
}
String[] identityRoleNames = roleNamesArr.toArray(new String[roleNamesArr.size()]);
for (int i = 0; i < identityRoleNames.length; i++) {
// if this is the first time a user signs up, needs to create role
doAddUser(i, admin, identityRoleNames, userName, permission);
}
} catch (UserStoreException e) {
throw IdentityException.error("Error occurred while adding user : " + userName + ". " + e.getMessage(), e);
}
}
示例6: addUser
private void addUser(String userName, String password, Map<String, String> claimList,
String profileName, UserRealm realm) throws IdentityException {
UserStoreManager admin = null;
Permission permission = null;
try {
// get config from tenant registry
TenantRegistrationConfig tenantConfig = getTenantSignUpConfig(realm.getUserStoreManager().getTenantId());
// set tenant config specific sign up domain
if (tenantConfig != null && !"".equals(tenantConfig.getSignUpDomain())) {
int index = userName.indexOf(UserCoreConstants.DOMAIN_SEPARATOR);
if (index > 0) {
userName = tenantConfig.getSignUpDomain().toUpperCase() + UserCoreConstants.DOMAIN_SEPARATOR
+ userName.substring(index + 1);
} else {
userName = tenantConfig.getSignUpDomain().toUpperCase() + UserCoreConstants.DOMAIN_SEPARATOR
+ userName;
}
}
// add user to the relevant user store
admin = realm.getUserStoreManager();
if (!isUserNameWithAllowedDomainName(userName, realm)) {
throw IdentityException.error("Domain does not permit self registration");
}
// add user
admin.addUser(userName, password, null, claimList, profileName);
// after adding the user, assign specif roles
List<String> roleNamesArr = getRoleName(userName, tenantConfig);
if (claimList.get(SelfRegistrationConstants.SIGN_UP_ROLE_CLAIM_URI) != null) {
// check is a user role is specified as a claim by the client, if so add it to the roles list
if (tenantConfig != null) {
roleNamesArr.add(tenantConfig.getSignUpDomain().toUpperCase()
+ UserCoreConstants.DOMAIN_SEPARATOR
+ claimList.get(SelfRegistrationConstants.SIGN_UP_ROLE_CLAIM_URI));
} else {
roleNamesArr.add(UserCoreConstants.INTERNAL_DOMAIN
+ UserCoreConstants.DOMAIN_SEPARATOR
+ claimList.get(SelfRegistrationConstants.SIGN_UP_ROLE_CLAIM_URI));
}
}
String[] identityRoleNames = roleNamesArr.toArray(new String[roleNamesArr.size()]);
for (int i = 0; i < identityRoleNames.length; i++) {
// if this is the first time a user signs up, needs to create role
doAddUser(i,admin, identityRoleNames,userName,permission);
}
} catch (UserStoreException e) {
throw IdentityException.error("Error occurred while adding user : " + userName + ". " + e.getMessage(), e);
}
}
示例7: createWorkflowRoleName
/**
* Generate owner role name for workflow.
*
* @param workflowName Workflow name
* @return
*/
public static String createWorkflowRoleName(String workflowName) {
return UserCoreConstants.INTERNAL_DOMAIN + UserCoreConstants.DOMAIN_SEPARATOR + workflowName;
}