Encoding the value of properties
To protect the value of a property, such as a password, you can include the encoded value of the property in the solution_properties.xml file. Add the encoded="true" parameter to the property element to indicate that the property value is encoded.
About this task
If you use solutionManager to set a property that has the encoded="true" attribute, you can use either a plain text value or a value that is encoded. Plain text values are automatically encoded by the default "exclusive or" (XOR) encoding in the Liberty profile. Use the securityUtility command to generate values using different encoding schemes. The securityUtility.bat and securityUtility.sh commands can be found under <InstallDir>/runtime/wlp/bin. For more information, see Liberty profile: securityUtility command.
The unencoded value can be retrieved by an agent and passed to an external system for user authentication, or any communication between systems that requires secure data. To modify the value of an encoded property, the administrator runs the solutionManager setproperty command. In the solutionManager setproperty command, the administrator enters either a plain text value or a value that is encoded in the securityUtility command.
The following code is an example of a solution_properties.xml file that contains an encoded parameter:
<properties>
<property name="my_scoring_endpoint.url">http://localhost:9080/my/scoring/service</property>
<property name="my_scoring_endpoint.user">user1</property>
<property name="my_scoring_endpoint.password" encoded="true">{xor}KzosKzot</property>
</properties>
In the previous example, {xor}KzosKzot is the encoded value. The solution_properties.xml file is in the root folder of the solution.
Another way to secure a property value is by adding the override="true" attribute to the property. A Java™ agent can use an encoded property value to retrieve the unencoded value by calling the getproperty API. See Adding user authentication for external systems.
In the following procedure, you learn how to encode a password through the securityUtility command.