Java Code Examples for org.wso2.carbon.user.api.Properties#setOptionalProperties()
The following examples show how to use
org.wso2.carbon.user.api.Properties#setOptionalProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserStoreConfigAdminService.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * Get User Store Manager default properties for a given implementation * * @param className Implementation class name for the user store * @return list of default properties(mandatory+optional) */ public Properties getUserStoreManagerProperties(String className) throws IdentityUserStoreMgtException { Properties properties = UserStoreManagerRegistry.getUserStoreProperties(className); if (properties != null && properties.getOptionalProperties() != null) { Property[] optionalProperties = properties.getOptionalProperties(); boolean foundUniqueIDProperty = false; for (Property property : optionalProperties) { if (UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT.equals(property.getName())) { foundUniqueIDProperty = true; break; } } if (!foundUniqueIDProperty) { if (LOG.isDebugEnabled()) { LOG.debug("Inserting property : " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT + " since " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT + " property not defined as an optional property in " + className + " class"); } List<Property> optionalPropertyList = new ArrayList<>(Arrays.asList(optionalProperties)); Property uniqueIDProperty = new Property( UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT, "", "", null); optionalPropertyList.add(uniqueIDProperty); properties.setOptionalProperties( optionalPropertyList.toArray(new Property[optionalPropertyList.size()])); } } return properties; }
Example 2
Source File: UserStoreConfigAdminService.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * Get User Store Manager default properties for a given implementation * * @param className:Implementation class name for the user store * @return : list of default properties(mandatory+optional) */ public Properties getUserStoreManagerProperties(String className) throws IdentityUserStoreMgtException { Properties properties = UserStoreManagerRegistry.getUserStoreProperties(className); if (properties != null && properties.getOptionalProperties() != null) { Property[] optionalProperties = properties.getOptionalProperties(); boolean foundUniqueIDProperty = false; for (Property property : optionalProperties) { if (UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT.equals(property.getName())) { foundUniqueIDProperty = true; break; } } if (!foundUniqueIDProperty) { if (log.isDebugEnabled()) { log.debug("Inserting property : " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT + " since " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT + " property not defined as an optional property in " + className + " class"); } List<Property> optionalPropertyList = new ArrayList<>(Arrays.asList(optionalProperties)); Property uniqueIDProperty = new Property( UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT, "", "", null); optionalPropertyList.add(uniqueIDProperty); properties.setOptionalProperties( optionalPropertyList.toArray(new Property[optionalPropertyList.size()])); } } return properties; }
Example 3
Source File: CarbonRemoteUserStoreManger.java From carbon-identity with Apache License 2.0 | 4 votes |
/** * */ @Override public Properties getDefaultUserStoreProperties() { Properties properties = new Properties(); Property[] mandatoryProperties = null; Property[] optionalProperties = null; Property remoteServerUserName = new Property( REMOTE_USER_NAME, "", "Remote Sever Username#Name of a user from the remote server, having enough privileges for user management", null); Property password = new Property(PASSWORD, "", "Remote Server Password#The password correspoing to the remote server " + "username#encrypt", null); Property serverUrls = new Property( SERVER_URLS, "", "Remote Server URL(s)#Remote server URLs. e.g.: https://ca-datacenter/services,https://va-datacenter/services", null); Property disabled = new Property("Disabled", "false", "Disabled#Check to disable the user store", null); Property passwordJavaScriptRegEx = new Property( UserStoreConfigConstants.passwordJavaScriptRegEx, "^[\\S]{5,30}$", "Password RegEx (Javascript)#" + UserStoreConfigConstants.passwordJavaScriptRegExDescription, null); Property usernameJavaScriptRegEx = new Property( UserStoreConfigConstants.usernameJavaScriptRegEx, "^[\\S]{3,30}$", "Username RegEx (Javascript)#" + UserStoreConfigConstants.usernameJavaRegExDescription, null); Property roleNameJavaScriptRegEx = new Property( UserStoreConfigConstants.roleNameJavaScriptRegEx, "^[\\S]{3,30}$", "Role Name RegEx (Javascript)#" + UserStoreConfigConstants.roleNameJavaScriptRegExDescription, null); mandatoryProperties = new Property[] {remoteServerUserName, password, serverUrls, passwordJavaScriptRegEx, usernameJavaScriptRegEx, roleNameJavaScriptRegEx}; optionalProperties = new Property[] {disabled}; properties.setOptionalProperties(optionalProperties); properties.setMandatoryProperties(mandatoryProperties); return properties; }