Skip to content

Commit 84f9a35

Browse files
Merge branch 'Issue#164-support-custom-security-providers' of github.com:oracle/weblogic-deploy-tooling into Issue#164-support-custom-security-providers
2 parents bd81929 + a275df4 commit 84f9a35

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def get_wlst_flattened_mbean_name(self, location):
318318
"""
319319
Get the flattened WLST folder name.
320320
:param location: the location
321-
:return: the flattened folder name
321+
:return: the flattened folder name
322322
:raises: AliasException: if an error occurs due to a bad location or bad alias data
323323
"""
324324
return self._alias_entries.get_wlst_flattened_name_for_location(location)

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from wlsdeploy.util import dictionary_utils
2020
from wlsdeploy.util.model import Model
2121
from wlsdeploy.util.weblogic_helper import WebLogicHelper
22-
22+
2323

2424
class Creator(object):
2525
"""
@@ -401,7 +401,7 @@ def _create_subfolders(self, location, model_nodes):
401401
if self.alias_helper.requires_artificial_type_subfolder_handling(sub_location):
402402
self.logger.finest('WLSDPLY-12116', key, str(sub_location), subfolder_nodes,
403403
class_name=self.__class_name, method_name=_method_name)
404-
self._create_security_provider_mbeans(key, subfolder_nodes, location)
404+
self._create_security_provider_mbeans(key, subfolder_nodes, location, True)
405405
elif len(subfolder_nodes) != 0:
406406
if self.alias_helper.supports_multiple_mbean_instances(sub_location):
407407
self.logger.finest('WLSDPLY-12109', key, str(sub_location), subfolder_nodes,
@@ -462,7 +462,10 @@ def _delete_existing_providers(self, location):
462462
The security realms providers in the model are processed as merge to the model. Each realm provider
463463
section must be complete and true to the resulting domain. Any existing provider not found in the
464464
model will be removed, and any provider in the model but not in the domain will be added. The resulting
465-
provider list will be ordered as listed in the model.
465+
provider list will be ordered as listed in the model. If the provider type (i.e. AuthenticationProvider)
466+
is not in the model, it is assumed no configuration or ordering is needed, and the provider is skipped.
467+
If the provider type is in the model, but there is no MBean entry under the provider, then it is
468+
assumed that all providers for that provider type must be removed.
466469
467470
For create, the default realm and default providers have been added by the weblogic base template and any
468471
extension templates. They have default values. These providers will be removed from the domain. During
@@ -477,9 +480,8 @@ def _delete_existing_providers(self, location):
477480
with the correct name. And the DefaultAuthenticationProvider successfully re-adds with the correct default
478481
identity asserter.
479482
480-
This release does not support updating the provider list. Because this means that the realms cannot be
481-
configured accurately, the security configuration is not configured. It is in the original configuration
482-
applied by the templates.
483+
This release also supports updating the security configuration realms in both offline and online mode. This
484+
release requires a complete list of providers as described in the first paragraph.
483485
484486
:param location: current context of the location pointing at the provider mbean
485487
"""
@@ -497,9 +499,9 @@ def _delete_existing_providers(self, location):
497499
self.wlst_helper.cd(create_path)
498500
for existing_folder_name in existing_folder_names:
499501
try:
502+
self.logger.info('WLSDPLY-12135', existing_folder_name, wlst_base_provider_type, create_path,
503+
class_name=self.__class_name, method_name=_method_name)
500504
self.wlst_helper.delete(existing_folder_name, wlst_base_provider_type)
501-
self.logger.finer('WLSDPLY-12135', existing_folder_name, wlst_base_provider_type, create_path,
502-
class_name=self.__class_name, method_name=_method_name)
503505
except BundleAwareException, bae:
504506
ex = exception_helper.create_exception(self._exception_type, 'WLSDPLY-12134', existing_folder_name,
505507
self.wls_helper.get_weblogic_version(),

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class SecurityProviderCreator(Creator):
2424
2525
Custom Security Providers are supported in 12c releases only.
2626
27-
Configuration of the security realms is not supported in 11g -
2827
Default providers in 11g have no name. Offline wlst returns 'Provider' as each provider name instead.
2928
By deleting and re-adding, the providers are added with the appropriate name field.
3029
@@ -39,7 +38,8 @@ class SecurityProviderCreator(Creator):
3938
5. All 11g and 12c versions less than 12.2.1.2 cannot perform a delete on an Adjudicator object.
4039
4140
The SecurityConfiguration is added if it does not exist. The default realm is added if it does not exist.
42-
If it is not an 11g target domain, then configure the realms with merge to model with the providers
41+
If the model provides a user defined realm, the default realm is not removed.
42+
4343
"""
4444
__class_name = 'SecurityProviderHelper'
4545

@@ -54,10 +54,11 @@ def __init__(self, model_dictionary, model_context, aliases, exception_type, log
5454
def create_security_configuration(self, location):
5555
"""
5656
Create the /SecurityConfiguration folder objects, if any.
57-
Update is calling this method. The SecurityConfiguration should already be configured by create domain, but
57+
58+
The SecurityConfiguration should already be configured by create domain, but
5859
allow the method to create the default security configuration with the default realm if for some reason
59-
it does not exit. Then bypass any configuration of the update from the model. The update tool does not
60-
support configuration of the SecurityConfiguration in this release.
60+
it does not exist.
61+
6162
:param location: the location to use
6263
:raises: BundleAwareException of the specified type: if an error occurs
6364
"""
@@ -67,19 +68,15 @@ def create_security_configuration(self, location):
6768
security_configuration_nodes = dictionary_utils.get_dictionary_element(self._topology, SECURITY_CONFIGURATION)
6869

6970
# in WLS 11g, the SecurityConfiguration mbean is not created until the domain is written.
70-
# This is called after the domain is written, but check to make sure the mbean exists.
71-
# if missing, we will create it to initialize realm and default security providers.
72-
# This release does not support configuring 11g security providers beyond making sure the default
73-
# realm exists.
71+
# This is called after the domain is written, but check to make sure the mbean does exist.
72+
# It missing it will be created to initialize the default realm and security providers.
7473
config_location = LocationContext(location).append_location(SECURITY_CONFIGURATION)
7574
existing_names = deployer_utils.get_existing_object_list(config_location, self.alias_helper)
7675
if len(existing_names) == 0:
7776
mbean_type, mbean_name = self.alias_helper.get_wlst_mbean_type_and_name(config_location)
7877
self.wlst_helper.create(mbean_name, mbean_type)
7978

80-
# This will leave 11g asis with the default security realm for the current release. No configuration
81-
# will be done to the 11g default security realm.
82-
if len(security_configuration_nodes) > 0: # and self._configure_security_configuration():
79+
if len(security_configuration_nodes) > 0:
8380
self._create_mbean(SECURITY_CONFIGURATION, security_configuration_nodes, location, log_created=True)
8481

8582
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
@@ -132,7 +129,8 @@ def __get_default_realm_location(self):
132129

133130
def _configure_security_configuration(self):
134131
"""
135-
For this release, the update tool will not configure the security realm.
132+
Keep this method in case we need to configure non-support.
133+
136134
:return: True if can configure the SecurityConfiguration mbean
137135
"""
138136
_method_name = '_configure_security_configuration'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
from java.lang import IllegalArgumentException
@@ -52,11 +52,13 @@ def update_security_folder(self, location, model_category, model_type, model_nam
5252
# create the MBean using the model name, model_type, category
5353

5454
location.append_location(model_category)
55-
mbean_category = self.alias_helper.get_wlst_mbean_type(location)
55+
token = self.alias_helper.get_name_token(location)
56+
location.add_name_token(token, model_name)
5657

58+
mbean_category = self.alias_helper.get_wlst_mbean_type(location)
5759
self.wlst_helper.create(model_name, model_type, mbean_category)
5860

59-
provider_path = create_path + '/' + mbean_category + '/' + model_name
61+
provider_path = self.alias_helper.get_wlst_attributes_path(location)
6062
provider_mbean = self.wlst_helper.cd(provider_path)
6163

6264
interface_name = model_type + 'MBean'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ WLSDPLY-12132=Unrecognized data type {0}
962962
WLSDPLY-12133=Unable to convert "{0}" to value of type {1}
963963
WLSDPLY-12134=Unable to remove "{0}" in target domain release {1}. The remove is required to properly configure \
964964
the Realm Provider Type {2}. Consult the WebLogic Deploy Tool documentation for further information. : {3}
965-
WLSDPLY-12135=Removed Security provider {0} with Provider type {1} at location {2}
965+
WLSDPLY-12135=Removing Security provider {0} with Provider type {1} at location {2}
966966
WLSDPLY-12136=No default providers installed for {0} at {1}
967967

968968
# domain_creator.py

0 commit comments

Comments
 (0)