Skip to content

Commit 8a641b2

Browse files
Fix for reorder of providers
1 parent c5ff114 commit 8a641b2

File tree

3 files changed

+22
-104
lines changed

3 files changed

+22
-104
lines changed

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

Lines changed: 13 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,12 @@
44
"""
55

66
from wlsdeploy.aliases.location_context import LocationContext
7-
from wlsdeploy.aliases.model_constants import ACTIVE_TYPE
8-
from wlsdeploy.aliases.model_constants import ADJUDICATOR
9-
from wlsdeploy.aliases.model_constants import AUDITOR
10-
from wlsdeploy.aliases.model_constants import AUTHENTICATION_PROVIDER
11-
from wlsdeploy.aliases.model_constants import AUTHORIZER
12-
from wlsdeploy.aliases.model_constants import CERT_PATH_PROVIDER
13-
from wlsdeploy.aliases.model_constants import CREDENTIAL_MAPPER
14-
from wlsdeploy.aliases.model_constants import DEFAULT_ADJUDICATOR_NAME
15-
from wlsdeploy.aliases.model_constants import DEFAULT_ADJUDICATOR_TYPE
16-
from wlsdeploy.aliases.model_constants import DEFAULT_AUDITOR_NAME
17-
from wlsdeploy.aliases.model_constants import DEFAULT_AUDITOR_TYPE
18-
from wlsdeploy.aliases.model_constants import DEFAULT_AUTHENTICATOR_NAME
19-
from wlsdeploy.aliases.model_constants import DEFAULT_AUTHENTICATOR_TYPE
20-
from wlsdeploy.aliases.model_constants import DEFAULT_AUTHORIZER_NAME
21-
from wlsdeploy.aliases.model_constants import DEFAULT_AUTHORIZER_TYPE
22-
from wlsdeploy.aliases.model_constants import DEFAULT_CERT_PATH_PROVIDER_NAME
23-
from wlsdeploy.aliases.model_constants import DEFAULT_CERT_PATH_PROVIDER_TYPE
24-
from wlsdeploy.aliases.model_constants import DEFAULT_CREDENTIAL_MAPPER_NAME
25-
from wlsdeploy.aliases.model_constants import DEFAULT_CREDENTIAL_MAPPER_TYPE
26-
from wlsdeploy.aliases.model_constants import DEFAULT_IDENTITY_ASSERTER_NAME
27-
from wlsdeploy.aliases.model_constants import DEFAULT_IDENTITY_ASSERTER_TYPE
28-
from wlsdeploy.aliases.model_constants import DEFAULT_PASSWORD_VALIDATOR_NAME
29-
from wlsdeploy.aliases.model_constants import DEFAULT_PASSWORD_VALIDATOR_TYPE
30-
from wlsdeploy.aliases.model_constants import DEFAULT_ROLE_MAPPER_NAME
31-
from wlsdeploy.aliases.model_constants import DEFAULT_ROLE_MAPPER_TYPE
32-
from wlsdeploy.aliases.model_constants import PASSWORD_VALIDATOR
337
from wlsdeploy.aliases.model_constants import REALM
34-
from wlsdeploy.aliases.model_constants import ROLE_MAPPER
358
from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION
369
from wlsdeploy.tool.create.creator import Creator
3710
from wlsdeploy.tool.deploy import deployer_utils
3811
from wlsdeploy.util import dictionary_utils
12+
import oracle.weblogic.deploy.util.WebLogicDeployToolingVersion as WDTVersion
3913

4014

4115
class SecurityProviderCreator(Creator):
@@ -45,16 +19,16 @@ class SecurityProviderCreator(Creator):
4519
4620
This release of weblogic deploy tool handles security providers as outlined below:
4721
48-
The update domain tool will not configure the SecurityConfiguration MBean.
22+
The update domain tool expects the security realm providers in the model to describe all non-default values of the
23+
existing domain realms.
4924
5025
Custom Security Providers are supported in 12c releases only.
5126
27+
Configuration of the security realms is not supported in 11g -
5228
Default providers in 11g have no name. Offline wlst returns 'Provider' as each provider name instead.
5329
The offline wlst will lose its way if you attempt to remove the MBean named provider, or if you rename
5430
the provider and attempt to rename the new provider and most of the time you can add
5531
56-
The SecurityConfiguration is added if it does not exist. The default realm is added if it does not exist.
57-
5832
In recap, the issues found for realms are as follows. These issues are handled in this release.
5933
1. The weblogic template in 11g installs default security providers with no name. In offline
6034
wlst, the names are represented as 'Provider'. There is no way to successfully fix the providers except to
@@ -65,6 +39,8 @@ class SecurityProviderCreator(Creator):
6539
4. Offline wlst in 11g does not support rename and delete of security providers
6640
4. Offline wlst in 11g and 12c does not support reorder of the security providers with the set statement.
6741
42+
The SecurityConfiguration is added if it does not exist. The default realm is added if it does not exist.
43+
If it is not an 11g target domain, then configure the realms with merge to model with the providers
6844
"""
6945
__class_name = 'SecurityProviderHelper'
7046

@@ -102,39 +78,14 @@ def create_security_configuration(self, location):
10278
mbean_type, mbean_name = self.alias_helper.get_wlst_mbean_type_and_name(config_location)
10379
self.wlst_helper.create(mbean_name, mbean_type)
10480

105-
self.__handle_default_security_providers()
106-
# This will leave 11g with the 'Provider' names. If future update is allowed, the update should handle
107-
# the 'Provider' if update is merge to model. Else, put code here to delete and re-add if in create and
108-
# no security configuration found in model.
81+
# This will leave 11g asis with the default security realm for the current release. No configuration
82+
# will be done to the 11g default security realm.
10983
if len(security_configuration_nodes) > 0 and self._configure_security_configuration():
11084
self._create_mbean(SECURITY_CONFIGURATION, security_configuration_nodes, location, log_created=True)
11185

11286
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
11387
return
11488

115-
def __handle_default_security_providers(self):
116-
_method_name = '__handle_default_security_providers'
117-
118-
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
119-
location, default_realm_name = self.__get_default_realm_location()
120-
#
121-
# Creating domains with the wls.jar template is busted for 11g domains with regards to the
122-
# names of the default authentication providers (both the DefaultAuthenticator and the
123-
# DefaultIdentityAsserter names are 'Provider', making it impossible to work with in WLST.
124-
if self.wls_helper.do_default_authentication_provider_names_need_fixing():
125-
# put a log here
126-
self._handle_default_provider(_get_default_adjudicators(), ADJUDICATOR, location)
127-
self._handle_default_provider(_get_default_auditors(), AUDITOR, location)
128-
self._handle_default_provider(_get_default_authentication_providers(), AUTHENTICATION_PROVIDER, location)
129-
self._handle_default_provider(_get_default_authorizers(), AUTHORIZER, location)
130-
self._handle_default_provider(_get_default_cert_path_providers(), CERT_PATH_PROVIDER, location)
131-
self._handle_default_provider(_get_default_credential_mappers(), CREDENTIAL_MAPPER, location)
132-
self._handle_default_provider(_get_default_password_validators(), PASSWORD_VALIDATOR, location)
133-
self._handle_default_provider(_get_default_role_mappers(), ROLE_MAPPER, location)
134-
135-
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
136-
return
137-
13889
def __get_default_realm_location(self):
13990
"""
14091
Ensure that the default realm exists and get the location object for it.
@@ -185,53 +136,11 @@ def _configure_security_configuration(self):
185136
For this release, the update tool will not configure the security realm.
186137
:return: True if can configure the SecurityConfiguration mbean
187138
"""
188-
if not self._domain_typedef.is_security_configuration_supported():
139+
_method_name = '_configure_security_configuration'
140+
if not self.wls_helper.is_configure_security_configuration_supported():
189141
# Do we bypass or end the update ?
190-
self.logger.warning('Unable to process SecurityConfiguration in update mode.')
142+
self.logger.warning('Unable to configure the SecurityConfiguration in the target domain release {0}'
143+
' using weblogic-deploy {1}', self.wls_helper.get_weblogic_version(),
144+
WDTVersion.getVersion(), class_name=self.__class_name, method_name=_method_name)
191145
return False
192146
return True
193-
194-
def _handle_default_provider(self, default_list, base_provider, base_location):
195-
location = LocationContext(base_location)
196-
location.append_location(base_provider)
197-
list_path = self.alias_helper.get_wlst_list_path(location)
198-
existing_folder_names = self._get_existing_folders(list_path)
199-
if len(existing_folder_names) > 0 and 'Provider' in existing_folder_names:
200-
create_path = self.alias_helper.get_wlst_create_path(location)
201-
self.wlst_helper.cd(create_path)
202-
for provider, provider_type in default_list.iteritems():
203-
self.wlst_helper.create(provider, provider_type, base_provider)
204-
return
205-
206-
207-
def _get_default_adjudicators():
208-
return {DEFAULT_ADJUDICATOR_NAME: DEFAULT_ADJUDICATOR_TYPE}
209-
210-
211-
def _get_default_auditors():
212-
return {DEFAULT_AUDITOR_NAME: DEFAULT_AUDITOR_TYPE}
213-
214-
215-
def _get_default_authentication_providers():
216-
return {DEFAULT_AUTHENTICATOR_NAME: DEFAULT_AUTHENTICATOR_TYPE,
217-
DEFAULT_IDENTITY_ASSERTER_NAME: DEFAULT_IDENTITY_ASSERTER_TYPE}
218-
219-
220-
def _get_default_authorizers():
221-
return {DEFAULT_AUTHORIZER_NAME: DEFAULT_AUTHORIZER_TYPE}
222-
223-
224-
def _get_default_cert_path_providers():
225-
return {DEFAULT_CERT_PATH_PROVIDER_NAME: DEFAULT_CERT_PATH_PROVIDER_TYPE}
226-
227-
228-
def _get_default_credential_mappers():
229-
return {DEFAULT_CREDENTIAL_MAPPER_NAME: DEFAULT_CREDENTIAL_MAPPER_TYPE}
230-
231-
232-
def _get_default_password_validators():
233-
return {DEFAULT_PASSWORD_VALIDATOR_NAME: DEFAULT_PASSWORD_VALIDATOR_TYPE}
234-
235-
236-
def _get_default_role_mappers():
237-
return {DEFAULT_ROLE_MAPPER_NAME: DEFAULT_ROLE_MAPPER_TYPE}

core/src/main/python/wlsdeploy/util/weblogic_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ def requires_security_provider_rename_in_offline_mode(self):
155155
result = True
156156
return result
157157

158+
def is_configure_security_configuration_supported(self):
159+
"""
160+
In the current release, configuring the SecurityConfiguration is not supported in 11g. There is
161+
no successful way to remove or reorder providers in the default realm. Will be investigated further.
162+
:return: True if can configure the security configuration with the model
163+
"""
164+
return self.is_weblogic_version_or_above('12.1.2')
165+
158166
# This method should be deleted once all of the old code is converted to the new model.
159167
def get_wlst_exception_content(self, message):
160168
"""

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ WLSDPLY-12228=The model does not define the required attribute {0} in the {1} se
993993
WLSDPLY-12229=Changing the administration server name from {0} to {1}
994994
WLSDPLY-12230=Creating placeholder for Coherence cluster {0}
995995
WLSDPLY-12231=Apply Domain {0} domain level attributes
996+
WLSDPLY-12232=Unable to configure the SecurityConfiguration in a domain release {0} using weblogic-deploy {1}
996997

997998
# domain_typedef.py
998999
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}

0 commit comments

Comments
 (0)