Skip to content

Commit e718742

Browse files
committed
Merge branch 'jira-wdt-890-default-realm' into 'main'
Get default realm from the model, since this is during domain creation See merge request weblogic-cloud/weblogic-deploy-tooling!1690
2 parents e85ed6e + 8cbce17 commit e718742

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

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

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class SecurityProviderCreator(Creator):
4646
5. All 11g and 12c versions less than 12.2.1.2 cannot perform a delete on an Adjudicator object.
4747
4848
The SecurityConfiguration is added if it does not exist. The default realm is added if it does not exist.
49-
If the model provides a user defined realm, the default realm is not removed.
50-
49+
If the model provides a user defined realm, the default realm is not removed.
50+
5151
"""
5252
__class_name = 'SecurityProviderCreator'
5353
__adjudicator_type = 'Adjudicator'
@@ -63,11 +63,11 @@ def __init__(self, model_dictionary, model_context, aliases, exception_type, log
6363
def create_security_configuration(self, location):
6464
"""
6565
Create the /SecurityConfiguration folder objects, if any.
66-
66+
6767
The SecurityConfiguration should already be configured by create domain, but
6868
allow the method to create the default security configuration with the default realm if for some reason
69-
it does not exist.
70-
69+
it does not exist.
70+
7171
:param location: the location to use
7272
:raises: BundleAwareException of the specified type: if an error occurs
7373
"""
@@ -338,8 +338,10 @@ def is_default_authenticator_password_digest_enabled(self):
338338
is_password_digest_enabled = False
339339
if self._topology:
340340
security_configuration = dictionary_utils.get_dictionary_element(self._topology, SECURITY_CONFIGURATION)
341+
realm_name = dictionary_utils.get_element(security_configuration, DEFAULT_REALM)
342+
realm_name = realm_name or 'myrealm'
343+
341344
realm = dictionary_utils.get_dictionary_element(security_configuration, REALM)
342-
realm_name = self.__get_default_realm_name()
343345
realm = dictionary_utils.get_dictionary_element(realm, realm_name)
344346
authenticators = dictionary_utils.get_dictionary_element(realm, AUTHENTICATION_PROVIDER)
345347
for atn_name, atn_dict in authenticators.iteritems():
@@ -351,27 +353,3 @@ def is_default_authenticator_password_digest_enabled(self):
351353

352354
self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=is_password_digest_enabled)
353355
return is_password_digest_enabled
354-
355-
def __get_default_realm_name(self):
356-
_method_name = '__get_default_realm_name'
357-
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
358-
359-
location = LocationContext()
360-
name_token = self.aliases.get_name_token(location)
361-
location.add_name_token(name_token, self.model_context.get_domain_name())
362-
security_configuration_wlst_path = self.aliases.get_wlst_attributes_path(location)
363-
364-
pwd = self.wlst_helper.get_pwd()
365-
366-
self.wlst_helper.cd(security_configuration_wlst_path)
367-
security_configuration = self.wlst_helper.lsa()
368-
default_realm_wlst_name = self.aliases.get_wlst_attribute_name(location, DEFAULT_REALM)
369-
if default_realm_wlst_name in security_configuration:
370-
default_realm_name = security_configuration[DEFAULT_REALM]
371-
else:
372-
default_realm_name = 'myrealm'
373-
374-
self.wlst_helper.cd(pwd)
375-
376-
self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=default_realm_name)
377-
return default_realm_name

0 commit comments

Comments
 (0)