Tuesday, February 21, 2017

How to insert vault key and password using admin services in ESB


Follow below steps to insert vault key and password.

  • To enable the AdminServices in esb set the HideAdminServiceWSDLs property to false in carbon.xml located in <ESB_HOME/repository/conf/carbon.xml.

<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

  • Restart the server to take effect of the configuration changes.

  • Create SOAPUI project using the below WSDLs (make sure to change the host name port as per your environment. Here default environment settings are used)

https://localhost:9443/services/PropertiesAdminService?wsdl

https://localhost:9443/services/MediationSecurityAdminService?wsdl

  • The SOAP projects will look like below.

  • First invoke the MediationSecurityAdminService AdminService to get the encrypted value. Please use basic authentication when invoking the AdminServices. Use the doEncrypt method as below.

  • Now invoke the PropertiesAdminService AdminService. Use the “SetProperty” method as below:

<ser:path> (Registry location) uses the /_system/config/repoitory/components/secure-vault (always this is the path for this element)

<ser:name> - Vault key

<ser:value> - encrypted value (this value received from the above doEncrypt method).


  • After adding this, you are able to check the password using “wso2:vault-lookup('shadsha12')” xpath expression. Following is sample proxy configuration that is used to check this scenario.

<?xml version="1.0" encoding="UTF-8"?>

<proxy xmlns="http://ws.apache.org/ns/synapse"

       name="testProxy"

       transports="https,http"

       statistics="disable"

       trace="disable"

       startOnLoad="true">

   <target>

      <inSequence>

         <log level="custom">

            <property name="new_Password" expression="wso2:vault-lookup('shadsha12')"/>

         </log>

         <drop/>

      </inSequence>

   </target>

   <description/>

</proxy

  • Received below results when invoking the above service.
 

Please refer [1] for more information on "Calling Admin Services from Apps".

[1] https://docs.wso2.com/display/ESB481/Calling+Admin+Services+from+Apps

No comments:

Post a Comment