Skip to content

Commit 8c06bc6

Browse files
Add WebserviceSecurity mbean for discovery
1 parent 02e029a commit 8c06bc6

File tree

6 files changed

+191
-2
lines changed

6 files changed

+191
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class AliasEntries(object):
110110
'VirtualHost',
111111
'VirtualTarget',
112112
'WSReliableDeliveryPolicy',
113+
'WebserviceSecurity',
113114
'XMLEntityCache',
114115
'XMLRegistry'
115116
]
@@ -644,13 +645,13 @@ def get_wlst_mbean_type_for_location(self, location):
644645
:raises AliasException: if an error occurs
645646
"""
646647
_method_name = 'get_wlst_mbean_type_for_location'
648+
_logger.entering(str(location), class_name=_class_name, method_name=_method_name)
647649

648650
# some callers use this method to check for location valid.
649651
# they should call is_model_location_valid(location) directly instead.
650652
if not self.is_model_location_valid(location):
651653
return None
652654

653-
_logger.entering(str(location), class_name=_class_name, method_name=_method_name)
654655
folder_dict = self.__get_dictionary_for_location(location, False)
655656
if folder_dict is None:
656657
wlst_type = None

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
WEB_SERVICE_PHYSICAL_STORE = 'WebServicePhysicalStore'
312312
WEB_SERVICE_REQUEST_BUFFERING_QUEUE = 'WebServiceRequestBufferingQueue'
313313
WEB_SERVICE_RESPONSE_BUFFERING_QUEUE = 'WebServiceResponseBufferingQueue'
314+
WEB_SERVICE_SECURITY = 'WebserviceSecurity'
314315
WEBLOGIC_CERT_PATH_PROVIDER = 'WebLogicCertPathProvider'
315316
WORK_MANAGER = "WorkManager"
316317
WLDF_INSTRUMENTATION_MONITOR = "WLDFInstrumentationMonitor"

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
from wlsdeploy.aliases.model_constants import WLS_USER_PASSWORD_CREDENTIAL_MAPPINGS
7373
from wlsdeploy.aliases.model_constants import WLS_DEFAULT_AUTHENTICATION
7474
from wlsdeploy.aliases.model_constants import WS_RELIABLE_DELIVERY_POLICY
75+
from wlsdeploy.aliases.model_constants import WEB_SERVICE_SECURITY
7576
from wlsdeploy.aliases.model_constants import XML_ENTITY_CACHE
7677
from wlsdeploy.aliases.model_constants import XML_REGISTRY
7778
from wlsdeploy.exception import exception_helper
@@ -692,6 +693,9 @@ def __create_mbeans_used_by_topology_mbeans(self, topology_folder_list):
692693
self.__create_xml_registry(location)
693694
topology_folder_list.remove(XML_REGISTRY)
694695

696+
self.__create_ws_security(location)
697+
topology_folder_list.remove(WEB_SERVICE_SECURITY)
698+
695699
def __create_security_folder(self):
696700
"""
697701
Create the the security objects if any. The security information
@@ -770,6 +774,20 @@ def __create_xml_registry(self, location):
770774
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
771775
return
772776

777+
def __create_ws_security(self, location):
778+
"""
779+
Create the WebserviceSecurity objects, if any.
780+
:param location: the current location
781+
"""
782+
_method_name = '__create_ws_security'
783+
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
784+
ws_security = dictionary_utils.get_dictionary_element(self._topology, WEB_SERVICE_SECURITY)
785+
786+
if len(ws_security) > 0:
787+
self._create_named_mbeans(WEB_SERVICE_SECURITY, ws_security, location, log_created=True)
788+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
789+
return
790+
773791
def __create_machines(self, location):
774792
"""
775793
Create the /Machine and /UnixMachine folder objects, if any.

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def discover(self):
108108
model_folder_name, folder_result = self._get_xml_registries()
109109
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
110110

111+
model_folder_name, folder_result = self._get_ws_securities()
112+
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
113+
111114
_logger.exiting(class_name=_class_name, method_name=_method_name)
112115
return self._dictionary
113116

@@ -521,6 +524,32 @@ def _get_xml_registries(self):
521524
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
522525
return model_top_folder_name, result
523526

527+
def _get_ws_securities(self):
528+
"""
529+
Discover the Webservice Security configuration for the domain
530+
:return: model name for the folder: dictionary containing the discovered webservice security
531+
"""
532+
_method_name = '_get_ws_securities'
533+
_logger.entering(class_name=_class_name, method_name=_method_name)
534+
model_top_folder_name = model_constants.WEB_SERVICE_SECURITY
535+
result = OrderedDict()
536+
location = LocationContext(self._base_location)
537+
location.append_location(model_top_folder_name)
538+
wssecurities = self._find_names_in_folder(location)
539+
if wssecurities is not None:
540+
_logger.info('WLSDPLY-06647', len(wssecurities), class_name=_class_name, method_name=_method_name)
541+
name_token = self._aliases.get_name_token(location)
542+
for wssecurity in wssecurities:
543+
_logger.info('WLSDPLY-06648', wssecurity, class_name=_class_name, method_name=_method_name)
544+
location.add_name_token(name_token, wssecurity)
545+
result[wssecurity] = OrderedDict()
546+
self._populate_model_parameters(result[wssecurity], location)
547+
self._discover_subfolders(result[wssecurity], location)
548+
location.remove_name_token(name_token)
549+
550+
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
551+
return model_top_folder_name, result
552+
524553
def _massage_security_credential(self, result, location):
525554
_method_name = 'massage_security_credential'
526555
# Determine if the SecurityConfiguration/CredentialEncrypted can be removed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"copyright": "Copyright (c) 2022, Oracle Corporation and/or its affiliates.",
3+
"license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl",
4+
"wlst_type": "WebserviceSecurit${y:ies}",
5+
"child_folders_type": "multiple",
6+
"short_name": "WSSecurity",
7+
"folders": {
8+
"WebserviceCredentialProvider" : {
9+
"wlst_type": "WebserviceCredentialProvider${:s}",
10+
"version": "[10,)",
11+
"child_folders_type": "multiple",
12+
"folders": {
13+
"ConfigurationProperty" : {
14+
"wlst_type": "ConfigurationPropert${y:ies}",
15+
"version": "[10,)",
16+
"child_folders_type": "multiple",
17+
"folders": {},
18+
"attributes": {
19+
"EncryptValueRequired": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "EncryptValueRequired", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "boolean" } ],
20+
"EncryptedValueEncrypted": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "EncryptedValueEncrypted", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "password", "get_method": "GET" } ],
21+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
22+
"Value": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Value", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ]
23+
},
24+
"wlst_attributes_path": "WP001",
25+
"wlst_paths": {
26+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceCredentialProvider${:s}/%WSCREDENTIAL%/ConfigurationPropert${y:ies}/%PROPERTY%"
27+
}
28+
}
29+
},
30+
"attributes": {
31+
"ClassName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClassName", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
32+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
33+
"TokenType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "TokenType", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ]
34+
},
35+
"wlst_attributes_path": "WP001",
36+
"wlst_paths": {
37+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceCredentialProvider${:s}/%WSCREDENTIAL%"
38+
}
39+
},
40+
"WebserviceSecurityToken" : {
41+
"wlst_type": "WebserviceSecurityToken{:s}",
42+
"version": "[10,)",
43+
"child_folders_type": "multiple",
44+
"folders": {
45+
"ConfigurationProperty" :
46+
{
47+
"wlst_type": "ConfigurationPropert{y:ies}",
48+
"version": "[10,)",
49+
"child_folders_type": "multiple",
50+
"folders": {},
51+
"attributes": {
52+
"EncryptValueRequired": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "EncryptValueRequired", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "boolean" } ],
53+
"EncryptedValueEncrypted": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "EncryptedValueEncrypted", "wlst_path": "WP001", "value": {"default": false }, "wlst_type": "password", "get_method": "GET" } ],
54+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
55+
"Value": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Value", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ]
56+
57+
},
58+
"wlst_attributes_path": "WP001",
59+
"wlst_paths": {
60+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceSecurityToken${:s}/%WSTOKEN%/ConfigurationPropert${y:ies}/%PROPERTY%"
61+
}
62+
}
63+
},
64+
"attributes": {
65+
"ClassName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClassName", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
66+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
67+
"TokenType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "TokenType", "wlst_path": "WP001", "value": {"default": "NONE" }, "wlst_type": "string" } ]
68+
},
69+
"wlst_attributes_path": "WP001",
70+
"wlst_paths": {
71+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceSecurityToken${:s}/%WSTOKEN%"
72+
}
73+
},
74+
"WebserviceTimestamp" : {
75+
"wlst_type": "WebserviceTimestamp",
76+
"version": "[10,)",
77+
"default_name_value": "${NO_NAME_0:%WEBSERVICE%}",
78+
"folders": {},
79+
"attributes": {
80+
"ClockSkew": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClockSkew", "wlst_path": "WP001", "value": {"default": 60000 }, "wlst_type": "integer" } ],
81+
"ClockSynchronized": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClockSynchronized", "wlst_path": "WP001", "value": {"default": true }, "wlst_type": "boolean" } ],
82+
"MaxProcessingDelay": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MaxProcessingDelay", "wlst_path": "WP001", "value": {"default": -1 }, "wlst_type": "integer" } ],
83+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
84+
"ValidityPeriod": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ValidityPeriod", "wlst_path": "WP001", "value": {"default": 60 }, "wlst_type": "integer" } ]
85+
},
86+
"wlst_attributes_path": "WP001",
87+
"wlst_paths": {
88+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceTimestamp/%WEBSERVICE%"
89+
}
90+
},
91+
"WebserviceTokenHandler" : {
92+
"wlst_type": "WebserviceTokenHandler{:s}",
93+
"version": "[10,)",
94+
"child_folders_type": "multiple",
95+
"folders": {
96+
"ConfigurationProperty" :
97+
{
98+
"wlst_type": "ConfigurationPropert{y:ies}",
99+
"version": "[10,)",
100+
"child_folders_type": "multiple",
101+
"folders": {},
102+
"attributes": {
103+
"EncryptValueRequired": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "EncryptValueRequired", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "boolean" } ],
104+
"EncryptedValueEncrypted": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "EncryptedValueEncrypted", "wlst_path": "WP001", "value": {"default": false }, "wlst_type": "password", "get_method": "GET" } ],
105+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
106+
"Value": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Value", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ]
107+
108+
},
109+
"wlst_attributes_path": "WP001",
110+
"wlst_paths": {
111+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceTokenHandler${:s}/%WSTOKENHANDLER%/ConfigurationPropert${y:ies}/%PROPERTY%"
112+
}
113+
}
114+
},
115+
"attributes": {
116+
"ClassName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClassName", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
117+
"HandlingOrder": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "HandlingOrder", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer" } ],
118+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
119+
"TokenType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "TokenType", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string " } ]
120+
},
121+
"wlst_attributes_path": "WP001",
122+
"wlst_paths": {
123+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%/WebserviceTokenHandler${:s}/%WSTOKENHANDLER%"
124+
}
125+
}
126+
},
127+
"attributes": {
128+
"CompatibilityOrderingPreference": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "CompatibilityOrderingPreference", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
129+
"CompatibilityPreference": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "CompatibilityPreference", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
130+
"DefaultCredentialProviderSTSURI": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DefaultCredentialProviderSTSURI", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
131+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
132+
"PolicySelectionPreference": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PolicySelectionPreference", "wlst_path": "WP001", "value": {"default": "NONE" }, "wlst_type": "string" } ]
133+
},
134+
"wlst_attributes_path": "WP001",
135+
"wlst_paths": {
136+
"WP001": "/WebserviceSecurit${y:ies}/%WEBSERVICE%"
137+
}
138+
139+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,8 @@ WLSDPLY-06642=Custom Keystore file {0} at location {1} is a kss type which is no
800800
WLSDPLY-06644=Adding Domain {0}
801801
WLSDPLY-06645=Machine is not present in domain. Remove SecurityConfiguration NodeManagerPasswordEncrypted default
802802
WLSDPLY-06646=Machine is present in domain so will not remove SecurityConfiguration NodeManagerPasswordEncrypted default
803-
803+
WLSDPLY-06647=Discovering {0} Web Service Securities
804+
WLSDPLY-06648=Adding Web Service Security {0}
804805

805806
# multi_tenant_discoverer.py, multi_tenant_resources_dsi
806807
WLSDPLY-06700=Discover Multi-tenant

0 commit comments

Comments
 (0)