ソースを参照

HPCC-18032 Add authentication to EspControl binding in esp.xml

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 8 年 前
コミット
c20fee7e9b

+ 57 - 1
initfiles/componentfiles/configxml/esp.xsl

@@ -217,7 +217,16 @@
                 <xsl:value-of disable-output-escaping="yes" select="$indent" />
                 <xsl:value-of disable-output-escaping="yes" select="$indent" />
                 <xsl:value-of disable-output-escaping="yes" select="$indent" />
-                <EspBinding name="{$bindName}" service="{$serviceName}" protocol="{$espBindingProtocol}" type="ws_espcontrolSoapBinding" plugin="{$servicePlugin}" netAddress="0.0.0.0" port="{$controlPort}"/>
+                <EspBinding name="{$bindName}" service="{$serviceName}" protocol="{$espBindingProtocol}" type="ws_espcontrolSoapBinding" plugin="{$servicePlugin}" netAddress="0.0.0.0" port="{$controlPort}">
+                    <xsl:if test="EspControlBinding">
+                        <xsl:variable name="authNode" select="Authentication[1]"/>
+                        <xsl:variable name="espControlBinding" select="EspControlBinding"/>
+                        <xsl:call-template name="bindAuthentication">
+                            <xsl:with-param name="bindingNode" select="$espControlBinding"/>
+                            <xsl:with-param name="authMethod" select="$authNode/@method"/>
+                        </xsl:call-template>
+                    </xsl:if>
+                </EspBinding>
             </xsl:if>
             <xsl:variable name="importedServiceDefinitionFiles">
                 <xsl:call-template name="importServiceDefinitionFiles">
@@ -621,6 +630,53 @@
         </xsl:for-each>
      </xsl:template>
 
+     <xsl:template name="bindAuthentication">
+        <xsl:param name="authMethod"/>
+        <xsl:param name="bindingNode"/>
+        <xsl:choose>
+           <xsl:when test="$authMethod='basic'">
+              <Authenticate type="Basic" method="UserDefined">
+                 <xsl:for-each select="$bindingNode/Authenticate[string(@path) != '']">
+                    <Location path="{@path}"/>
+                 </xsl:for-each>
+              </Authenticate>
+           </xsl:when>
+           <xsl:when test="$authMethod='local'">
+              <Authenticate method="Local">
+                 <xsl:for-each select="$bindingNode/Authenticate[string(@path) != '']">
+                    <Location path="{@path}" resource="{@resource}" required="{@access}" description="{@description}"/>
+                 </xsl:for-each>
+              </Authenticate>
+           </xsl:when>
+           <xsl:when test="$authMethod='ldap' or $authMethod='ldaps'">
+              <Authenticate method="LdapSecurity" config="ldapserver">
+                 <xsl:copy-of select="$bindingNode/@resourcesBasedn"/>
+                 <xsl:for-each select="$bindingNode/Authenticate[string(@path) != '']">
+                    <Location path="{@path}" resource="{@resource}" access="{@access}" description="{@description}"/>
+                 </xsl:for-each>
+                 <xsl:for-each select="$bindingNode/AuthenticateFeature[@authenticate='Yes']">
+                    <Feature name="{@name}" path="{@path}" resource="{@resource}" required="{@access}" description="{@description}"/>
+                 </xsl:for-each>                              
+              </Authenticate>
+           </xsl:when>
+           <xsl:when test="$authMethod='secmgrPlugin'">
+              <Authenticate>
+                 <xsl:attribute name="method">
+                    <xsl:value-of select="$bindingNode/@type"/>
+                 </xsl:attribute>
+                 <xsl:copy-of select="$bindingNode/@resourcesBasedn"/>
+                 <xsl:for-each select="$bindingNode/Authenticate[string(@path) != '']">
+                    <Location path="{@path}" resource="{@resource}" access="{@access}" description="{@description}"/>
+                 </xsl:for-each>
+
+                 <xsl:for-each select="$bindingNode/AuthenticateFeature[@authenticate='Yes']">
+                    <Feature name="{@name}" path="{@path}" resource="{@resource}" required="{@access}" description="{@description}"/>
+                 </xsl:for-each>
+              </Authenticate>
+           </xsl:when>
+        </xsl:choose>
+     </xsl:template>
+   
         <xsl:template name="printUniqueTokens">
             <xsl:param name="s"/><!--space delimited string of tokens with space as last char-->
             <xsl:param name="enclosingTagName"/>

+ 19 - 0
initfiles/etc/DIR_NAME/environment.xml.in

@@ -430,6 +430,25 @@
                   required="Read"
                   resource="WsEclAccess"/>
    </EspBinding>
+   <EspControlBinding defaultForPort="true"
+               defaultServiceVersion=""
+               name="espcontrol"
+               protocol="http"
+               resourcesBasedn="ou=WsEspControl,ou=EspServices,ou=ecl"
+               service="espcontrol"
+               type=""
+               wsdlServiceAddress="">
+    <Authenticate access="Read"
+               description="Root access to WS Esp Control service"
+               path="/"
+               required="Read"
+               resource="WsEspControlAccess"/>
+    <AuthenticateFeature authenticate="Yes"
+               description="Access to WS Esp Control service"
+               path="WsEspControlAccess"
+               resource="WsEspControlAccess"
+               service="espcontrol"/>
+   </EspControlBinding>
   </EspProcess>
   <Directories name="${DIR_NAME}">
    <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/log/[NAME]/[INST]" name="log"/>