Topic
  • 3 replies
  • Latest Post - ‏2013-05-06T16:11:38Z by swlinn
jimcpl
jimcpl
6 Posts

Pinned topic Setting a var in AAA action/step

‏2013-05-04T19:17:45Z |

I am trying to set the identity/credential in the 1st step of an AAA policy, from an incoming HTTP header.  With help from here, I can get/access the HTTP header, but having trouble setting that value into the var.

What I am trying in an XSLT that is pointed to by the extract username step of the AAA policy is:

 

    <xsl:variable name="server-name" select="/container/server-name"/>
    <xsl:variable name="ipaddr" select="dp:client-ip-addr()"/>
    <xsl:variable name="incominguser" select="dp:http-request-header('OAM_REMOTE_USER')"/>
 
    <dp:set-variable name="var://context/WSM/identity/credentials" value="<xsl:copy-of select="$incominguser" />" />

It's throwing a compile error on the dp:set-variable line.

 

Can someone tell me the correct format for that line to set the identity/credentials var to the header value in the $incominguser variable?

 

Thanks,

Jim

 

  • RolfRander
    RolfRander
    23 Posts

    Re: Setting a var in AAA action/step

    ‏2013-05-04T21:02:56Z  

    You cannot have xslt-code inside the value-attribute. However, both name and value are XPath-expressions, so you can refer to $incominguser directlye:

    <dp:set-variable name="'var://context/WSM/identity/credentials'" value="$incominguser" />

    Please note that there are single quotes ' inside the double quotes " of the name-attribute. This is because the attribute is evaluated as an XPath-expression, so it must be an XPath string, i.e. contained in quotes.

     

    regards, rolf rander

  • jimcpl
    jimcpl
    6 Posts

    Re: Setting a var in AAA action/step

    ‏2013-05-04T23:36:03Z  

    You cannot have xslt-code inside the value-attribute. However, both name and value are XPath-expressions, so you can refer to $incominguser directlye:

    <dp:set-variable name="'var://context/WSM/identity/credentials'" value="$incominguser" />

    Please note that there are single quotes ' inside the double quotes " of the name-attribute. This is because the attribute is evaluated as an XPath-expression, so it must be an XPath string, i.e. contained in quotes.

     

    regards, rolf rander

    Hi Rolf,

     

    Thanks.  Using what you suggested eliminates the compile error, however when I look at the context variables in the probe at the point after the AAA action, it still shows var://context/WSM/identity/credentials as "(empty string)"

     

    var://context/WSM/identity/authenticated-user string (empty string)
    var://context/WSM/identity/credentials string (empty string)

    Shouldn't the identity/credentials be populated with whatever was in the incoming HTTP header "OAM_REMOTE_USER"?

     

    Thanks,

    Jim

  • swlinn
    swlinn
    1348 Posts

    Re: Setting a var in AAA action/step

    ‏2013-05-06T16:11:38Z  
    • jimcpl
    • ‏2013-05-04T23:36:03Z

    Hi Rolf,

     

    Thanks.  Using what you suggested eliminates the compile error, however when I look at the context variables in the probe at the point after the AAA action, it still shows var://context/WSM/identity/credentials as "(empty string)"

     

    var://context/WSM/identity/authenticated-user string (empty string)
    var://context/WSM/identity/credentials string (empty string)

    Shouldn't the identity/credentials be populated with whatever was in the incoming HTTP header "OAM_REMOTE_USER"?

     

    Thanks,

    Jim

    DataPower's AAA action will set up these variables on your behalf based on the output of your EI custom stylesheet.  You should output your EI node set only, and the AAA action will populate these values.  What could be happening is that your stylesheet isn't outputting anything, which is then overwriting your set-variable with the output of your AAA action.

    Regards,

    Steve