Studio Visual Editor
-
Open the properties editor, then click the Security tab.
-
Click the plus sign icon in the Add Configuration Element pane to create a new key-value pair.
In XML, this step mirrors the addition of a key-value pair inside the ws-config
child element of aws-security
element. By adding configuration elements to your SOAP component, you are creating a map of key-value pairs that correspond to the CXF WSS4J security-configuration text strings in WSHandlerConstants and WSConstants. -
Enter a key, such as
action
, in the open Key field and press Enter. -
Double-click the new key-value line item you created to open the Add Configuration Property panel.
-
Enter information in either the Value field OR the Value Reference Field according to the table below.
Value
Enter a WS Constant (a class to define the kind of access the server allows) or a WSHandlerConstant (a class to specify the names, actions, and other strings for data deployment of the WSS handler). For example, enter
UsernameToken
in the value field.Value Reference
Enter the bean that the key must reference. When the key must reference a bean (for instance, when the key is
passwordCallbackRef
), enter the name of the bean in the Value Reference field. -
Click Finish to save the key-value pair.
-
Repeat the steps above to add as many ws-security configurations as you wish to your API, then click OK to save your configurations.
Studio Visual Editor or Standalone
-
To your CXF element (i.e. SOAP component), add a child element for
cxf:ws-security
. -
Within the
cxf:ws-security
child element, add a child element forcxf:ws-config
. -
Within the
cxf:ws-config
child element, add a child element forcxf:property
. -
Add two attributes to the cxf:property child element according to the table below. Be sure to enter either a
value `OR a `value-ref
; the two are mutually exclusive.Attribute
Description
key
Specify a name for the property.
value
Specify a WS Constant (a class to define the kind of access the server allows) or a WSHandlerConstant (a class to specify the names, actions, and other strings for data deployment of the WSS handler). For example, enter
UsernameToken
in the value field.value- ref
Specify the bean that the key must reference. When the key must reference a bean (for instance, when the key is
passwordCallbackRef
), specify the name of the bean as the value-ref. -
Repeat the preceding step to add as many WS-security configurations as you wish to your API. Refer to sample code below.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd">
<http:listener-config name="listener-config" host="localhost" port="8081"/>
<flow name="Creation1Flow1" doc:name="Creation1Flow1">
<http:listener config-ref="listener-config" path="/" doc:name="HTTP Connector"/>
<cxf:jaxws-service doc:name="SOAP">
<cxf:ws-security>
<cxf:ws-config>
<cxf:property key="action" value="UsernameToken"/>
</cxf:ws-config>
</cxf:ws-security>
</cxf:jaxws-service>
</flow>