Skip to content

Commit a86efe0

Browse files
Perform reorder of security providers. Do not configure securityconfiguration in update mode
1 parent c72f494 commit a86efe0

File tree

3 files changed

+77
-287
lines changed

3 files changed

+77
-287
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from oracle.weblogic.deploy.util import WLSDeployArchive
77

88
from wlsdeploy.aliases.location_context import LocationContext
9+
from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION
910
from wlsdeploy.aliases.validation_codes import ValidationCodes
1011
from wlsdeploy.exception import exception_helper
1112
from wlsdeploy.exception.expection_types import ExceptionType
@@ -186,9 +187,14 @@ def _create_security_provider_mbeans(self, type_name, model_nodes, base_location
186187
known_providers = self.alias_helper.get_model_subfolder_names(location)
187188
allow_custom = str(self.alias_helper.is_custom_folder_allowed(location))
188189

190+
# For create, delete the existing nodes, and re-add in order found in model in iterative code below
191+
self._delete_existing_providers(location)
192+
189193
for model_name in model_nodes:
190194
model_node = model_nodes[model_name]
191195

196+
# Need to create the node first ?
197+
self.logger.fine('Adding the provider {0} at location {1}', model_name, str(location))
192198
if model_node is None:
193199
# The node is empty so nothing to do... move to the next named node.
194200
continue
@@ -383,6 +389,7 @@ def _create_subfolders(self, location, model_nodes):
383389

384390
for key in model_nodes:
385391
if key in model_subfolder_names:
392+
386393
subfolder_nodes = model_nodes[key]
387394
if len(subfolder_nodes) != 0:
388395
sub_location = LocationContext(location).append_location(key)
@@ -443,6 +450,50 @@ def _process_flattened_folder(self, location):
443450
self.wlst_helper.create(mbean_name, mbean_type)
444451
return
445452

453+
def _delete_existing_providers(self, location):
454+
"""
455+
The security realms providers in the model are processed as merge to the model. Each realm provider
456+
section must be complete and true to the resulting domain. Any existing provider not found in the
457+
model will be removed, and any provider in the model but not in the domain will be added. The resulting
458+
provider list will be ordered as listed in the model.
459+
460+
For create, the default realm and default providers have been added by the weblogic base template and any
461+
extension templates. They have default values. These providers will be removed from the domain. During
462+
the normal iteration through the provider list, the providers, if in the model, will be re-added in model
463+
order. Any attributes in the model that are not the default value are then applied to the the new provider.
464+
465+
By deleting all providers and re-adding from the model, we are both merging to the model and ordering the
466+
providers. In offline wlst, the set<providertype>Providers(<provider_object_list>, which reorders existing
467+
providers, does not work. Deleting the providers and re-adding also has the added benefit of fixing the 11g
468+
problem where the providers have no name. They are returned with the name 'Provider'. In the authentication
469+
provider, there are two default providers, and just setting the name does not work. When we re-add we re-add
470+
with the correct name. And the DefaultAuthenticationProvider successfully re-adds with the correct default
471+
identity asserter.
472+
473+
This release does not support updating the provider list. Because this means that the realms cannot be
474+
configured accurately, the security configuration is not configured. It is in the original configuration
475+
applied by the templates.
476+
477+
:param location: current context of the location pointing at the provider mbean
478+
"""
479+
_method_name = '_delete_existing_providers'
480+
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
481+
482+
list_path = self.alias_helper.get_wlst_list_path(location)
483+
existing_folder_names = self._get_existing_folders(list_path)
484+
wlst_base_provider_type, wlst_name = self.alias_helper.get_wlst_mbean_type_and_name(location)
485+
if len(existing_folder_names) == 0:
486+
self.logger.finer('No default providers installed for {0} at {1}', wlst_base_provider_type, list_path)
487+
else:
488+
create_path = self.alias_helper.get_wlst_create_path(location)
489+
self.wlst_helper.cd(create_path)
490+
for existing_folder_name in existing_folder_names:
491+
self.wlst_helper.delete(existing_folder_name, wlst_base_provider_type)
492+
self.logger.finer('Removed default provider {0} from provider {1} at location {2}',
493+
existing_folder_name, wlst_base_provider_type, create_path)
494+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
495+
return
496+
446497
def _get_existing_folders(self, wlst_path):
447498
"""
448499
Get the list of existing folders at the specified WLST path.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ def is_system_wldf(self, name):
210210
"""
211211
return self._is_system_name(name, 'wldf')
212212

213-
def configure_realm_is_supported_by_tool(self, realm):
213+
def configure_security_configuration_is_supported_by_tool(self):
214214
"""
215-
Determine if the realm can be configured. Currently, update domain does not support configuration of any
216-
realm.
217-
#param realm_name: can the tool configure this realm
215+
Determine if the security configuration can be configured. Currently, update domain does not
216+
support configuration of any providers within a realm. Potentially safest to not touch security
217+
configuration at all in order to not set values conducive to the realms (like active realm)
218+
218219
:return: True if the security realm can be configured
219220
"""
220-
# self.wls_helper.get_default_security_realm_name() == realm_name
221221
return self._program_name != UPDATE_DOMAIN
222222

223223
def _is_system_name(self, name, key):

0 commit comments

Comments
 (0)