NoamRotter_1534
Jan 22, 2017Nimbostratus
Convert UPN from X509 to sAMAcountName
Hello,
I have this code to get UPN to a variable named session.logon.last.upn:
Code
set e_fields [split [mcget {session.ssl.cert.x509extension}] "\n"];
foreach qq $e_fields {
if {[string first "othername:UPN" $qq] >= 0} {
return [string range $qq [expr { [string first "<" $qq] + 1 } ] [expr
{ [string first ">" $qq] - 1 } ] ];
}
}
return ""
This works fine
Now, I need to query my AD/LDAP to convert the UPN to sAMAccountName.
i.e: if UPN is: 012345678@local
sAMAccountName will be: testuser@domain.local
How do I query the AD/LDAP and find the sAMAccountName based on the UPN?
Thank you,
Noam.