Skip to content

Commit 7e4527b

Browse files
CarolynRountreeddsharpe
authored andcommitted
Wdt 247# discover custom security mbean (#413)
* Discover custom security provider and attribute value conversion * Jira WDT-247 fix some logging statements and order of credential check
1 parent a4ead66 commit 7e4527b

File tree

13 files changed

+1144
-109
lines changed

13 files changed

+1144
-109
lines changed

core/src/main/java/oracle/weblogic/deploy/util/CustomBeanUtils.java renamed to core/src/main/java/oracle/weblogic/deploy/create/CustomBeanUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
33
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
44
*/
5-
package oracle.weblogic.deploy.util;
5+
package oracle.weblogic.deploy.create;
66

77
import oracle.weblogic.deploy.aliases.TypeUtils;
88
import oracle.weblogic.deploy.exception.ExceptionHelper;

core/src/main/python/wlsdeploy/aliases/alias_constants.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
SEMI_COLON_DELIMITED_STRING = 'delimited_string[semicolon]'
8383
SPACE_DELIMITED_STRING = 'delimited_string[space]'
8484
STRING = 'string'
85+
MASKED = '<masked>'
8586

8687
ALIAS_DELIMITED_TYPES = [
8788
COMMA_DELIMITED_STRING,
@@ -113,6 +114,12 @@
113114
STRING
114115
]
115116

117+
ALIAS_NUMERIC_DATA_TYPES = [
118+
DOUBLE,
119+
INTEGER,
120+
LONG
121+
]
122+
116123
ALIAS_DATA_TYPES = list()
117124
ALIAS_DATA_TYPES.extend(ALIAS_PRIMITIVE_DATA_TYPES)
118125
ALIAS_DATA_TYPES.extend(ALIAS_LIST_TYPES)

core/src/main/python/wlsdeploy/tool/create/creator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from wlsdeploy.exception import exception_helper
1111
from wlsdeploy.exception.expection_types import ExceptionType
1212
from wlsdeploy.logging.platform_logger import PlatformLogger
13-
from wlsdeploy.util import dictionary_utils
13+
from wlsdeploy.tool.create.custom_folder_helper import CustomFolderHelper
1414
from wlsdeploy.tool.util.alias_helper import AliasHelper
1515
from wlsdeploy.tool.util.attribute_setter import AttributeSetter
16-
from wlsdeploy.tool.util.custom_folder_helper import CustomFolderHelper
16+
from wlsdeploy.util import dictionary_utils
1717
from wlsdeploy.tool.util.wlst_helper import WlstHelper
1818
from wlsdeploy.util.model import Model
1919
from wlsdeploy.util.weblogic_helper import WebLogicHelper

core/src/main/python/wlsdeploy/tool/util/custom_folder_helper.py renamed to core/src/main/python/wlsdeploy/tool/create/custom_folder_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from java.lang import IllegalArgumentException
66
from java.lang import IllegalAccessException
77
from java.lang.reflect import InvocationTargetException
8-
from oracle.weblogic.deploy.util import CustomBeanUtils
8+
from oracle.weblogic.deploy.create import CustomBeanUtils
99

1010
from wlsdeploy.aliases.location_context import LocationContext
1111
from wlsdeploy.exception import exception_helper
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""
2+
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
The Universal Permissive License (UPL), Version 1.0
4+
"""
5+
6+
_class_name = 'custom_discoverer'

core/src/main/python/wlsdeploy/tool/discover/custom_folder_helper.py

Lines changed: 525 additions & 0 deletions
Large diffs are not rendered by default.

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
from wlsdeploy.exception import exception_helper
1717
from wlsdeploy.exception.expection_types import ExceptionType
1818
from wlsdeploy.logging.platform_logger import PlatformLogger
19+
1920
from wlsdeploy.tool.util.mbean_utils import MBeanUtils
21+
from wlsdeploy.tool.discover.custom_folder_helper import CustomFolderHelper
2022
from wlsdeploy.tool.util.alias_helper import AliasHelper
2123
from wlsdeploy.tool.util.wlst_helper import WlstHelper
2224
from wlsdeploy.util import path_utils
@@ -49,10 +51,11 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
4951
self._aliases = Aliases(self._model_context, wlst_mode=self._wlst_mode)
5052
self._alias_helper = AliasHelper(self._aliases, _logger, ExceptionType.DISCOVER)
5153
self._att_handler_map = OrderedDict()
54+
self._custom_folder = CustomFolderHelper(self._aliases, _logger, self._model_context, ExceptionType.DISCOVER)
5255
self._weblogic_helper = WebLogicHelper(_logger)
53-
self._wls_version = self._weblogic_helper.get_actual_weblogic_version()
5456
self._wlst_helper = WlstHelper(_logger, ExceptionType.DISCOVER)
5557
self._mbean_utils = MBeanUtils(self._model_context, self._alias_helper, ExceptionType.DISCOVER)
58+
self._wls_version = self._weblogic_helper.get_actual_weblogic_version()
5659

5760
# methods for use only by the subclasses
5861

@@ -356,19 +359,19 @@ def _discover_subfolder_with_single_name(self, model_subfolder_name, location, n
356359
_logger.exiting(class_name=_class_name, method_name=_method_name)
357360
return result
358361

359-
def _discover_artificial_folder(self, model_subfolder_name, location, name_token):
362+
def _discover_artificial_folder(self, model_subfolder_type, location, name_token):
360363
"""
361364
Discover the subfolder that has an artificial connection; the subfolder contains multiple different types
362365
under one MBean. The model must contain the subfolder type, the artificial type that specifies which it is,
363366
and the name of the subfolder. This folder is only one layer deep. No need to continue to discover
364367
additional subfolders
365-
:param model_subfolder_name: type of the model subfolder
368+
:param model_subfolder_type: type of the model subfolder
366369
:param location: context containing the current location information
367370
:param name_token: for use in the location to contain the folder name
368371
:return: dictionary containing the discovered folder attributes
369372
"""
370373
_method_name = '_discover_artifical_folder'
371-
_logger.entering(model_subfolder_name, str(location), name_token, class_name=_class_name,
374+
_logger.entering(model_subfolder_type, str(location), name_token, class_name=_class_name,
372375
method_name=_method_name)
373376
subfolder_result = OrderedDict()
374377
names = self._find_names_in_folder(location)
@@ -378,10 +381,16 @@ def _discover_artificial_folder(self, model_subfolder_name, location, name_token
378381
location.add_name_token(name_token, massaged)
379382
artificial = self._get_artificial_type(location)
380383
if artificial is None:
381-
_logger.warning('WLSDPLY-06123', self._alias_helper.get_model_folder_path(location),
382-
class_name=_class_name, method_name=_method_name)
384+
if self._alias_helper.is_custom_folder_allowed(location):
385+
_logger.fine('WLSDPLY-06148', model_subfolder_type, massaged, location.get_folder_path(),
386+
class_name=_class_name, method_name=_method_name)
387+
subfolder_result = self._custom_folder.discover_custom_mbean(location, model_subfolder_type,
388+
massaged)
389+
else:
390+
_logger.warning('WLSDPLY-06123', self._alias_helper.get_model_folder_path(location),
391+
class_name=_class_name, method_name=_method_name)
383392
else:
384-
_logger.finer('WLSDPLY-06120', artificial, massaged, model_subfolder_name, class_name=_class_name,
393+
_logger.finer('WLSDPLY-06120', artificial, massaged, model_subfolder_type, class_name=_class_name,
385394
method_name=_method_name)
386395
location.append_location(artificial)
387396
subfolder_result[massaged] = OrderedDict()
@@ -665,9 +674,6 @@ def _inspect_security_folder_name(self, folder_name, location):
665674
self._alias_helper.is_security_provider_type(location) and 'Provider' == folder_name:
666675
raise exception_helper.create_discover_exception('WLSDPLY-06201', folder_name, location.get_folder_path())
667676

668-
_logger.fine('version {0} mode {1} type? {2} provider {3}', not self._weblogic_helper.is_version_in_12c(),
669-
self._wlst_mode == WlstModes.OFFLINE, self._alias_helper.is_security_provider_type(location),
670-
'Provider' == folder_name)
671677
return folder_name
672678

673679

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
The Universal Permissive License (UPL), Version 1.0
4+
"""
5+
6+
# Constant values representing the properties in the WebLogic Server Class java.beans.PropertyDescriptor
7+
ATTRIBUTE_DEFAULT = 'default'
8+
ATTRIBUTE_ENCRYPTED = 'encrypted'
9+
ATTRIBUTE_GETTER = 'readMethod'
10+
ATTRIBUTE_NAME = 'name'
11+
ATTRIBUTE_SETTER = 'writeMethod'
12+
ATTRIBUTE_TYPE = 'propertyType'
13+

0 commit comments

Comments
 (0)