APM variable assign examples
Problem this snippet solves: APM variable assign is a powerful tool to manipulate APM variable during policy evaluation supporting tcl code.
On Devcentral answers, there are lots of variable assig...
Updated Jun 06, 2023
Stanislas_Piro2
Cumulonimbus
Joined January 04, 2011
Stanislas_Piro2
Cumulonimbus
Feb 16, 2019@Joe Lupo, try this code:
set subject [split [mcget {session.ssl.cert.subject}] ",="];
foreach {name value} $subject {
if {[string trim $name] eq "CN"} {
return [join [lrange [split [string trim $value] "."] 0 1] "."];
}
}
the CN is split to a list with dot as separator (
split text ".")... then the first 2 words (lrange list 0 1) are converted to string with dot between list items (join list ".") ...
if there is no dot in CN, the whole string will be returned.Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)