Skip to content

Commit a158bfd

Browse files
committed
cleaning up the security provider validation and provisioning code to not try to create a provider that is version invalid
1 parent 0a0890d commit a158bfd

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2023, Oracle and/or its affiliates.
2+
Copyright (c) 2017, 2024, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55

@@ -8,6 +8,7 @@
88
from wlsdeploy.aliases.location_context import LocationContext
99
from wlsdeploy.aliases.model_constants import REALM
1010
from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION
11+
from wlsdeploy.aliases.validation_codes import ValidationCodes
1112
from wlsdeploy.exception import exception_helper
1213
from wlsdeploy.tool.create.creator import Creator
1314
from wlsdeploy.tool.deploy import deployer_utils
@@ -139,6 +140,13 @@ def _create_named_subtype_mbeans(self, type_name, model_nodes, base_location, lo
139140

140141
model_type_subfolder_name = list(model_node.keys())[0]
141142
child_nodes = dictionary_utils.get_dictionary_element(model_node, model_type_subfolder_name)
143+
folder_validation_code, folder_validation_message = \
144+
self.aliases.is_valid_model_folder_name(location, model_type_subfolder_name)
145+
if folder_validation_code == ValidationCodes.CONTEXT_INVALID:
146+
ex = exception_helper.create_exception(self._exception_type, 'WLSDPLY-12144', type_name,
147+
model_type_subfolder_name, folder_validation_message)
148+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
149+
raise ex
142150

143151
# custom providers require special processing, they are not described in alias framework
144152
if allow_custom and (model_type_subfolder_name not in known_providers):

core/src/main/python/wlsdeploy/tool/validate/validator.py

+15-12
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ def __validate_section_folder(self, model_node, validation_location):
548548

549549
def __process_model_node(self, model_node, validation_location):
550550
_method_name = '__process_model_node'
551+
self._logger.entering(str_helper.to_string(validation_location),
552+
class_name=_class_name, method_name=_method_name)
551553

552554
model_folder_path = self._aliases.get_model_folder_path(validation_location)
553555

@@ -574,7 +576,12 @@ def __process_model_node(self, model_node, validation_location):
574576
self._logger.finer('key={0}', key,
575577
class_name=_class_name, method_name=_method_name)
576578

577-
if key in valid_folder_keys:
579+
folder_validation_code, folder_validation_message = \
580+
self._aliases.is_valid_model_folder_name(validation_location, key)
581+
attribute_validation_code, attribute_validation_message = \
582+
self._aliases.is_valid_model_attribute_name(validation_location, key)
583+
584+
if folder_validation_code == ValidationCodes.VALID:
578585
new_location = LocationContext(validation_location).append_location(key)
579586
self._logger.finer('new_location={0}', new_location,
580587
class_name=_class_name, method_name=_method_name)
@@ -588,8 +595,7 @@ def __process_model_node(self, model_node, validation_location):
588595
self.__validate_attributes(value, valid_attr_infos, new_location)
589596
else:
590597
self.__validate_section_folder(value, new_location)
591-
592-
elif key in valid_attr_infos:
598+
elif attribute_validation_code == ValidationCodes.VALID:
593599
# aliases.get_model_attribute_names_and_types(location) filters out
594600
# attributes that ARE NOT valid in the wlst_version being used, so if
595601
# we're in this section of code we know key is a bonafide "valid" attribute
@@ -605,7 +611,10 @@ def __process_model_node(self, model_node, validation_location):
605611

606612
self.__validate_attribute(key, value, valid_attr_infos, path_tokens_attr_keys, model_folder_path,
607613
validation_location)
608-
614+
elif folder_validation_code == ValidationCodes.CONTEXT_INVALID:
615+
self._log_context_invalid(folder_validation_message, _method_name)
616+
elif attribute_validation_code == ValidationCodes.CONTEXT_INVALID:
617+
self._log_context_invalid(attribute_validation_message, _method_name)
609618
elif self._aliases.is_custom_folder_allowed(validation_location):
610619
# custom folders are not validated, just log this and continue
611620
self._logger.info('WLSDPLY-05037', model_folder_path,
@@ -623,10 +632,7 @@ def __process_model_node(self, model_node, validation_location):
623632
# method pulls those out, in the self.__validate_section_folder().
624633

625634
# See if it's a version invalid folder
626-
result, message = self._aliases.is_valid_model_folder_name(validation_location, key)
627-
if result == ValidationCodes.CONTEXT_INVALID:
628-
self._log_context_invalid(message, _method_name)
629-
elif result == ValidationCodes.INVALID:
635+
if folder_validation_code == ValidationCodes.INVALID:
630636
# key is an INVALID folder
631637
self._logger.severe('WLSDPLY-05026', key, 'folder', model_folder_path,
632638
'%s' % ', '.join(valid_folder_keys), class_name=_class_name,
@@ -637,10 +643,7 @@ def __process_model_node(self, model_node, validation_location):
637643
# method pulls those out, in the self.__validate_section_folder().
638644

639645
# See if it's a version invalid attribute
640-
result, message = self._aliases.is_valid_model_attribute_name(validation_location, key)
641-
if result == ValidationCodes.CONTEXT_INVALID:
642-
self._log_context_invalid(message, _method_name)
643-
elif result == ValidationCodes.INVALID:
646+
if attribute_validation_code == ValidationCodes.INVALID:
644647
# key is an INVALID attribute
645648
self._logger.severe('WLSDPLY-05029', key, model_folder_path,
646649
'%s' % ', '.join(valid_attr_infos), class_name=_class_name,

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

+1
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,7 @@ WLSDPLY-12140=Security configuration adjudicator has {0} subtypes
15801580
WLSDPLY-12141=Security configuration adjudicator subtype is {0}
15811581
WLSDPLY-12142=Security configuration adjudicator has {0} attributes
15821582
WLSDPLY-12143=Setting subfolders, then attributes for model location path {0} from WLST path {1}
1583+
WLSDPLY-12144=Unable to create {0} security provider type {1}: {2}
15831584

15841585
# domain_creator.py
15851586
WLSDPLY-12200={0} did not find the required {1} section in the model file {2}

documentation/4.0/content/release-notes/_index.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ pre = "<b> </b>"
5454
- #1579 - Fixed an issue that limited the number of secret keys that could be referenced by the model.
5555
- #1584 - Fixed an issue where online updates that required restarts were using a 12.2.1+ API even with older versions.
5656
- #1603 - Fixed a bug related to online WLST error message formatting.
57-
57+
- #1608 - Fixed a bug in creating Security groups that are members of another group.
58+
- #1610 - Fixed a bug where the Create Domain and Update Domain Tools were trying to create a security provider that
59+
is not valid in the current WebLogic Server version.
5860
#### Known Issues
5961
None
6062

0 commit comments

Comments
 (0)