|
11 | 11 | from oracle.weblogic.deploy.util import WLSDeployArchiveIOException
|
12 | 12 |
|
13 | 13 | from wlsdeploy.aliases import model_constants
|
| 14 | +from wlsdeploy.aliases.alias_constants import PASSWORD_TOKEN |
14 | 15 | from wlsdeploy.aliases.location_context import LocationContext
|
15 | 16 | from wlsdeploy.aliases.wlst_modes import WlstModes
|
16 | 17 | from wlsdeploy.exception import exception_helper
|
|
21 | 22 | from wlsdeploy.tool.discover.discoverer import Discoverer
|
22 | 23 | from wlsdeploy.tool.discover.jms_resources_discoverer import JmsResourcesDiscoverer
|
23 | 24 | from wlsdeploy.util import dictionary_utils
|
24 |
| -import wlsdeploy.util.unicode_helper as str_helper |
25 | 25 |
|
26 | 26 | _class_name = 'CommonResourcesDiscoverer'
|
27 | 27 | _logger = PlatformLogger(discoverer.get_discover_logger_name())
|
@@ -553,28 +553,17 @@ def _get_named_resources(self, folder_name):
|
553 | 553 | return model_top_folder_name, result
|
554 | 554 |
|
555 | 555 |
|
556 |
| -def _fix_passwords_in_mail_session_properties(dictionary): |
| 556 | +def _fix_passwords_in_mail_session_properties(mail_session_dict): |
557 | 557 | """
|
558 | 558 | Look for password properties in the mail session properties string, and replace the password with a fix me token.
|
559 |
| - :param dictionary: containing the discovered mail session attributes |
| 559 | + :param mail_session_dict: containing the discovered mail session attributes |
560 | 560 | """
|
561 |
| - match_pattern = "mail\.\w*\.?password" |
562 |
| - replacement = '--FIX ME--' |
563 |
| - if model_constants.MAIL_SESSION_PROPERTIES in dictionary: |
564 |
| - new_properties = '' |
565 |
| - string_properties = dictionary[model_constants.MAIL_SESSION_PROPERTIES] |
566 |
| - if string_properties: |
567 |
| - properties = string_properties |
568 |
| - if isinstance(string_properties, basestring): |
569 |
| - properties = StringUtils.formatPropertiesFromString(string_properties) |
570 |
| - new_properties = OrderedDict() |
571 |
| - iterator = properties.stringPropertyNames().iterator() |
572 |
| - while iterator.hasNext(): |
573 |
| - key = iterator.next() |
574 |
| - new_key = str_helper.to_string(key).strip() |
575 |
| - value = str_helper.to_string(properties.getProperty(key)) |
576 |
| - tokenized = value.startswith('@@') |
577 |
| - if StringUtils.matches(match_pattern, new_key) and not tokenized: |
578 |
| - value = replacement |
579 |
| - new_properties[new_key] = value |
580 |
| - dictionary[model_constants.MAIL_SESSION_PROPERTIES] = new_properties |
| 561 | + match_pattern = r'mail\.\w*\.?password' |
| 562 | + if model_constants.MAIL_SESSION_PROPERTIES in mail_session_dict: |
| 563 | + # alias framework has converted properties to a dictionary by this point |
| 564 | + properties_dict = mail_session_dict[model_constants.MAIL_SESSION_PROPERTIES] |
| 565 | + for property_name in properties_dict: |
| 566 | + property_value = properties_dict[property_name] |
| 567 | + is_tokenized = property_value.startswith('@@') |
| 568 | + if StringUtils.matches(match_pattern, property_name) and not is_tokenized: |
| 569 | + properties_dict[property_name] = PASSWORD_TOKEN |
0 commit comments