Tuesday, September 4, 2012

Executing Carbon admin services from Proxy service

Carbon V4.0.0  provides ability to invoke admin services using proxy service. We could point the admin service as an endpoint.
Each request must have Basic-Auth headers, which has to be set as transport headers.
In mediation flow, we could use property mediator to set the authentication headers.

<property name="Authorization" expression="fn:concat('Basic ', base64Encode('UserName:Password'))"
scope="transport"/>


We have to provide admin username and password to be encoded and set as transport header.

You might need to set <HostnameVerifier> parameter to AllowAll in the HTTPS transport sender configuration which is defined in axis2.xml.

Sample proxy conf;

<proxy name="adminServiceProxy" transports="https http"
          startOnLoad="true" trace="disable">
      <description/>
      <target>
         <endpoint>
            <address uri="https://localhost:9444/services/UserProfileMgtService"/>
         </endpoint>
         <inSequence>
            <property name="Authorization"
                      expression="fn:concat('Basic ', base64Encode('admin:admin'))"
                      scope="transport"/>
         </inSequence>
         <outSequence>
          <send/>
         </outSequence>
      </target>
   </proxy>

No comments:

Post a Comment