search cancel

Assertion Attribute Expression


Article ID: 201940


Updated On:


CA Single Sign On Secure Proxy Server (SiteMinder) CA Single Sign On Agents (SiteMinder) CA Single Sign On Federation (SiteMinder) CA Single Sign On SOA Security Manager (SiteMinder) SITEMINDER



We're running a Policy Server and we'd like to know how to escape
backslash "\" character in JUEL expression in order to get the output
as :


How can we do this ?




Policy Server 12.8SP3 on RedHat 7




At first glance, it seems that backslash is reserved in EL to avoid
evaluation of an expression :

  Unified Expression Language (JSR-245) in OFBiz

     If you need to display an expression as-is (you don't want it
     evaluated) you can escape expression evaluation with a backslash:
  Java Unified Expression Language

    2.6. Specification Issues JUEL tries to be as close as possible to
    the EL specification.

    2. In section 1.2.3, "Literal Expressions", the specification
       states that "the escape characters \$ and \# can
    be used to escape what would otherwise be treated as an
    eval-expression". The specification doesn't tell us if '\' is used
    to escape other characters in literal expressions,
    too. Consequently, JUEL treats '\' as escape character only when
    immediately followed by '${' and '#{'.  Note Expression \\${
    evaluates to '\${', whereas \$ evaluates to '\$' and \\ evaluates
    to '\\'.
    3. In section 1.3, "Literals", the specification states that
       "Quotes only need to be escaped in a string value
    enclosed in the same type of quote". This suggests that, e.g.,
    "You could escape a single quote in a double-quoted string, but
    it's not necessary". JUEL guesses that you can't and that the
    above should read as "Quotes can only be escaped in a string value
    enclosed in the same type of quote".  Note The '\' in expression
    ${'\"'} doesn't escape the double quote.

To keep the backslash as character, the following post might help
you :

How to display backslash \ literally between two EL expressions
without escaping the 2nd expression?

  I have a value attribute:
  value="#{}\\ #{mgdBean.file}" I need to trim the
  white space between directory and file name so that the value
  appears as: Directory\File.  I cannot remove the white space because
  of the escape sequence \ which would escape the 2nd EL expression.

  Display it with EL as well:
  * For me this worked:
    value="#{}#{\"\\\\\"}#{mgdBean.file}" (I use
    tomcat bundled el-api.jar)     m4gic Nov 13 '18 at 13:49




Insert the backslash character as per the following sample expression:


to be able to get Domain\User