Skip to content

Commit 15280cd

Browse files
committed
Merge branch 'wdt-856' into 'develop-4.0'
Update new and existing entries in DefaultAuthenticatorInit.ldift; use correct encryption for PasswordDigestEnabled See merge request weblogic-cloud/weblogic-deploy-tooling!1653
2 parents 69c616b + 3e32885 commit 15280cd

File tree

12 files changed

+565
-135
lines changed

12 files changed

+565
-135
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
PARTITION_SYSTEM_FILE = 'SystemFileSystem'
213213
PARTITION_USER_FILE = 'UserFileSystem'
214214
PARTITION_WORK_MANAGER = 'PartitionWorkManager'
215+
PASSWORD_DIGEST_ENABLED = 'PasswordDigestEnabled'
215216
PASSWORD_VALIDATOR = 'PasswordValidator'
216217
PATH = 'Path'
217218
PATH_SERVICE = 'PathService'

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,15 +808,17 @@ def __create_mbeans_used_by_topology_mbeans(self, topology_folder_list):
808808

809809
def __create_security_folder(self):
810810
"""
811-
Create the the security objects if any. The security information
811+
Create the security objects if any. The security information
812812
from the model will be writing to the DefaultAuthenticatorInit.ldift file
813813
:raises: CreateException: if an error occurs
814814
"""
815815
_method_name = '__create_security_folder'
816816
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
817817
security_folder = dictionary_utils.get_dictionary_element(self._topology, SECURITY)
818818
if security_folder is not None:
819-
helper = DefaultAuthenticatorHelper(self.model_context, self.aliases, ExceptionType.CREATE)
819+
using_password_digests = self.security_provider_creator.is_default_authenticator_password_digest_enabled()
820+
helper = DefaultAuthenticatorHelper(self.model_context, self.aliases, ExceptionType.CREATE,
821+
using_password_digests)
820822
helper.create_default_init_file(security_folder)
821823
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
822824

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
from oracle.weblogic.deploy.exception import BundleAwareException
77

88
from wlsdeploy.aliases.location_context import LocationContext
9+
from wlsdeploy.aliases.model_constants import AUTHENTICATION_PROVIDER
10+
from wlsdeploy.aliases.model_constants import DEFAULT_AUTHENTICATOR
11+
from wlsdeploy.aliases.model_constants import DEFAULT_REALM
12+
from wlsdeploy.aliases.model_constants import PASSWORD_DIGEST_ENABLED
913
from wlsdeploy.aliases.model_constants import REALM
1014
from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION
1115
from wlsdeploy.aliases.validation_codes import ValidationCodes
@@ -326,3 +330,48 @@ def _is_default_adjudicator_configuration(self, model_nodes):
326330

327331
def is_adjudicator_changeable(self):
328332
return self._wls_helper.is_weblogic_version_or_above('12.2.1.4')
333+
334+
def is_default_authenticator_password_digest_enabled(self):
335+
_method_name = 'is_default_authenticator_password_digest_enabled'
336+
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
337+
338+
is_password_digest_enabled = False
339+
if self._topology:
340+
security_configuration = dictionary_utils.get_dictionary_element(self._topology, SECURITY_CONFIGURATION)
341+
realm = dictionary_utils.get_dictionary_element(security_configuration, REALM)
342+
realm_name = self.__get_default_realm_name()
343+
realm = dictionary_utils.get_dictionary_element(realm, realm_name)
344+
authenticators = dictionary_utils.get_dictionary_element(realm, AUTHENTICATION_PROVIDER)
345+
for atn_name, atn_dict in authenticators.iteritems():
346+
if DEFAULT_AUTHENTICATOR in atn_dict:
347+
default_authenticator = atn_dict[DEFAULT_AUTHENTICATOR]
348+
is_password_digest_enabled = \
349+
dictionary_utils.get_boolean_element(default_authenticator, PASSWORD_DIGEST_ENABLED)
350+
break
351+
352+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=is_password_digest_enabled)
353+
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)