search cancel

Assertion Attribute Expression

book

Article ID: 201940

calendar_today

Updated On:

Products

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

Issue/Introduction

 

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 :

  Domain\User

How can we do this ?

 

Cause

 

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:
     \${someExpression}.

  https://cwiki.apache.org/confluence/display/OFBIZ/Unified+Expression+Language+%28JSR-245%29+in+OFBiz
  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.

  http://juel.sourceforge.net/juel.pdf

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.directory}\\ #{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:
  value="#{mgdBean.directory}#{'\\'}#{mgdBean.file}"
  * For me this worked:
    value="#{mgdBean.directory}#{\"\\\\\"}#{mgdBean.file}" (I use
    tomcat bundled el-api.jar)     m4gic Nov 13 '18 at 13:49

https://stackoverflow.com/questions/8163457/how-to-display-backslash-literally-between-two-el-expressions-without-escaping

 

Environment

 

Policy Server 12.8SP3 on RedHat 7

 

Resolution

 

Insert the backslash character as per the following sample expression:

   #{"domain\\"}#{attr["uid"]}

to be able to get Domain\User