Search code examples
xmlxsltxsdwsdlmule

IP permission in .XSLT file for seeing XML(WSDL) file?


I have a XML(WSDL) file that I want to manage it by using .XSLT file. I want to set IP permission in my .XSLT file for seeing some part of WSDL that some restricted IPs can see some part of my WSDL. I have this WSDL :

          <wsdl:types>
        ...
      </wsdl:types>

      <wsdl:message>
        ...
      </wsdl:message>

      <wsdl:portType name="countrySoap">
         <wsdl:operation name="GetCountryByCountryCode">
             <wsdl:documentation>Get country name by country code</wsdl:documentation>
             <wsdl:input message="tns:GetCountryByCountryCodeSoapIn" />
             <wsdl:output message="tns:GetCountryByCountryCodeSoapOut" />
         </wsdl:operation>
        <wsdl:operation name="GetISD">
            <wsdl:documentation>Get International Dialing Code </wsdl:documentation>
            <wsdl:input message="tns:GetISDSoapIn" />
            <wsdl:output message="tns:GetISDSoapOut" />
        </wsdl:operation>
        ...
      </wsdl:portType>

  ....

This is my .xslt file:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
        <xsl:output method="xml" indent="yes"/>

        <xsl:template match="@* | node()">
            <xsl:copy>
                <xsl:apply-templates select="@* | node()"/>
            </xsl:copy>
        </xsl:template>

  <xsl:template match="wsdl:operation[@name = 'GetISD']" />
</xsl:stylesheet>

Now I want to set IP permission that for example : 10.10.10.1 can't see this part of my WSDL :

 <wsdl:operation name="GetISD">
    <wsdl:documentation>Get International Dialing Code </wsdl:documentation>
    <wsdl:input message="tns:GetISDSoapIn" />
    <wsdl:output message="tns:GetISDSoapOut" />
</wsdl:operation>

How can I do it?


Solution

  • Can you use Authorization at operation level to achieve this? When implementing web services operation, define roles and users with valid permissions are able to access certain operations. By just restricting their view, you'd still have to deal with unauthorized access to service