Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

How to combine two variables together in APM variable assign

Hi

I would like do combine two variables together:

Right now I have something like this: session.logon.last.username = expr { [mcget {session.ntlm.last.username}] }

And I want to have something like that: session.logon.last.username = expr { [mcget {session.ntlm.last.domain}" \"{session.ntlm.last.username}] }

--> session.logon.last.username should contain DOMAIN\USERNAME

How is that possible?

thanx bb

4
Rate this Question
Comments on this Question
Comment made 13-Aug-2013 by Lucas Thompson
Hi, thanks for the question. In Variable Assign (or branch rules), you can include any TCL you want. The TCL command "expr" is used because the results are mostly boolean. For a variable assignment though, they are mostly strings, so the expr command in this context is inappropriate. Better to use "return". This avoids problems where expr's number conversion can mess up text strings. So, to concatenate them, it would be simply: session.logon.last.username = return "[mcget {session.ntlm.last.username}]\\[mcget {session.ntlm.last.domain}]" If you want, you can also put some logic in the right-hand of the assignment, like if sometimes the user already put in USERNAME\DOMAIN: session.logon.last.username = if { [mcget "session.logon.last.username"] contains "\\" } { return [mcget "session.logon.last.username"] else { return "[mcget {session.ntlm.last.username}]\\[mcget {session.ntlm.last.domain}]" }
2

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Ahh, back in my lab and now see what you're trying to do. Your last attempt was actually pretty close. In your variable assignment, try this:

session.logon.last.username = expr { "f5-lab.local\\[mcget {session.logon.last.username}]" }
1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

To answer the question about how to combine the two variables, this should work:

session.logon.last.username = expr { [concat "[mcget {session.ntlm.last.domain}]\\[mcget {session.ntlm.last.username}]" ] }

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I tried both methods the "return" and the "expr" one and both seems to work fine for me if I check the session variables in the APM report. But when using a RDP with auto logon enabled, it just puts the username into the RDP logon mask. Interesting thing is, if I just use a single "\" in the expression the result in the session variable is:

DOMAIN[mcget {session.logon.last.username}]

but it will be exactly filled in that way in the RDP logon mask.

Any idea what I'm doing wrong or what I can further try?

Thank you!

Ciao Stefan :)

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Mcget is used in branch conditions. If you need variable expansion, like in a configuration object, try using the ${ } syntax instead:

DOMAIN\\${session.logon.last.username}
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi Kevin,

this seems to be not working at all. It's neither correctly displayed in the session variables (APM report) nor correctly filled in the RDP logon mask (just the username). I tried these different options:

session.logon.last.username = f5-lab.local\\${session.logon.last.username}

session.logon.last.username = return "f5-lab.local\\[mcget {session.logon.last.username}]"

session.logon.last.username = expr { [concat "f5-lab.local\\[mcget {session.logon.last.username}]" ] }

Ciao Stefan :)

0
Comments on this Answer
Comment made 11-Jul-2014 by Kevin Stewart
Try changing it to a single backslash. I didn't have a chance to test.
0
Comment made 11-Jul-2014 by Stefan Klotz 929
No, doesn't make any difference.
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi Kevin,

yes this syntax is correct and it will correctly be shown in the session variable (APM report). But it's still not parsed to the WinXP RDP logon mask, there just the real username is shown. I also tried several other syntax, which also worked correctly from the session variable point of view, but for NONE of them the combined variable will be parsed to the RDP logon mask. For your reference I'm using the following order in VPE:

Logon Page -> LDAP Auth -> Variable Assign -> Resource Assign -> Webtop and Links Assign

Any further idea? Thank you!

Ciao Stefan :)

0