/** * Check whether the given property should be encrypted or not. * * @param mandatoryProperties mandatory property array * @param propertyName property name * @return returns true if the property should be encrypted */ private boolean isPropertyToBeEncrypted(Property[] mandatoryProperties, String propertyName) { for (Property property : mandatoryProperties) { if (propertyName.equalsIgnoreCase(property.getName())) { return property.getDescription().contains(UserStoreConfigurationConstant.ENCRYPT_TEXT); } } return false; }
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)#"
/** * Check whether the given property should be encrypted or not. * * @param mandatoryProperties mandatory property array * @param propertyName property name * @return returns true if the property should be encrypted */ private boolean isPropertyToBeEncrypted(Property[] mandatoryProperties, String propertyName) { for (Property property : mandatoryProperties) { if (propertyName.equalsIgnoreCase(property.getName())) { return property.getDescription().contains(UserStoreConfigurationConstant.ENCRYPT_TEXT); } } return false; }
/** * Get the list of properties from mandatoryProperties list * * @param userStoreClass class name of user store * @return ArrayList consisting of mandatory properties to be encrypted */ private static ArrayList<String> getEncryptPropertyList(String userStoreClass) { //First check for mandatory field with #encrypt Property[] mandatoryProperties = UserStoreManagerRegistry.getUserStoreProperties(userStoreClass). getMandatoryProperties(); ArrayList<String> propertyList = new ArrayList<String>(); for (Property property : mandatoryProperties) { if (property != null) { String propertyName = property.getName(); if (propertyName != null && property.getDescription().contains (UserStoreConfigurationConstants.ENCRYPT_TEXT)) { propertyList.add(propertyName); } } } return propertyList; }
/** * Get the list of properties from mandatoryProperties list * * @param userStoreClass class name of user store * @return ArrayList consisting of mandatory properties to be encrypted */ private static ArrayList<String> getEncryptPropertyList(String userStoreClass) { //First check for mandatory field with #encrypt Property[] mandatoryProperties = UserStoreManagerRegistry.getUserStoreProperties(userStoreClass). getMandatoryProperties(); ArrayList<String> propertyList = new ArrayList<String>(); for (Property property : mandatoryProperties) { if (property != null) { String propertyName = property.getName(); if (propertyName != null && property.getDescription().contains (UserStoreConfigurationConstants.ENCRYPT_TEXT)) { propertyList.add(propertyName); } } } return propertyList; }
/** * Get the list of properties from mandatoryProperties list * * @param userStoreClass class name of user store * @return ArrayList consisting of mandatory properties to be encrypted */ private static ArrayList<String> getEncryptPropertyList(String userStoreClass) { //First check for mandatory field with #encrypt Property[] mandatoryProperties = UserStoreManagerRegistry.getUserStoreProperties(userStoreClass). getMandatoryProperties(); ArrayList<String> propertyList = new ArrayList<String>(); for (Property property : mandatoryProperties) { if (property != null) { String propertyName = property.getName(); if (propertyName != null && property.getDescription().contains (UserStoreConfigurationConstants.ENCRYPT_TEXT)) { propertyList.add(propertyName); } } } return propertyList; }
/** * Generate the RandomPassword[] from secondaryRealmConfiguration for given userStoreClass * * @param userStoreClass Extract the mandatory properties of this class * @param randomPhrase The randomly generated keyword which will be stored in * RandomPassword object * @param secondaryRealmConfiguration RealmConfiguration object consists the properties * @return RandomPassword[] array for each property */ private RandomPassword[] getRandomPasswordProperties(String userStoreClass, String randomPhrase, RealmConfiguration secondaryRealmConfiguration) { //First check for mandatory field with #encrypt Property[] mandatoryProperties = getMandatoryProperties(userStoreClass); ArrayList<RandomPassword> randomPasswordArrayList = new ArrayList<RandomPassword>(); for (Property property : mandatoryProperties) { String propertyName = property.getName(); if (property.getDescription().contains(UserStoreConfigurationConstant.ENCRYPT_TEXT)) { RandomPassword randomPassword = new RandomPassword(); randomPassword.setPropertyName(propertyName); randomPassword.setPassword(secondaryRealmConfiguration.getUserStoreProperty(propertyName)); randomPassword.setRandomPhrase(randomPhrase); randomPasswordArrayList.add(randomPassword); } } return randomPasswordArrayList.toArray(new RandomPassword[randomPasswordArrayList.size()]); }
/** * Generate the RandomPassword[] from secondaryRealmConfiguration for given userStoreClass * * @param userStoreClass Extract the mandatory properties of this class * @param randomPhrase The randomly generated keyword which will be stored in * RandomPassword object * @param secondaryRealmConfiguration RealmConfiguration object consists the properties * @return RandomPassword[] array for each property */ private RandomPassword[] getRandomPasswordProperties(String userStoreClass, String randomPhrase, RealmConfiguration secondaryRealmConfiguration) { //First check for mandatory field with #encrypt Property[] mandatoryProperties = getMandatoryProperties(userStoreClass); ArrayList<RandomPassword> randomPasswordArrayList = new ArrayList<RandomPassword>(); for (Property property : mandatoryProperties) { String propertyName = property.getName(); if (property.getDescription().contains(UserStoreConfigurationConstant.ENCRYPT_TEXT)) { RandomPassword randomPassword = new RandomPassword(); randomPassword.setPropertyName(propertyName); randomPassword.setPassword(secondaryRealmConfiguration.getUserStoreProperty(propertyName)); randomPassword.setRandomPhrase(randomPhrase); randomPasswordArrayList.add(randomPassword); } } return randomPasswordArrayList.toArray(new RandomPassword[randomPasswordArrayList.size()]); }