For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Clint_124473's avatar
Clint_124473
Icon for Nimbostratus rankNimbostratus
Jun 07, 2013

XML Dump of all Session Variables

I am looking for a way to spit back out all my session variables dynamically. For now I just have some I can anticipate. For example:

when HTTP_REQUEST {
    if {[HTTP::cookie exists MRHSession]} {
        set MRHSession [HTTP::cookie value MRHSession]
        if { [HTTP::uri] == "/whoami" } {
            set apmsessionid [ACCESS::session data get "session.user.sessionid"]
            set apmsessionuser [ACCESS::session data get "session.logon.last.username"]
            set apmsessionlanding [ACCESS::session data get "session.server.landinguri"]
            set apmsessiondomain [ACCESS::session data get "session.ad.last.actualdomain"]
            set htmlStream "\r\n\r\n\t\r\n\t\t$apmsessionid\r\n\t\t$apmsessionuser\r\n\t\t$apmsessionlanding\r\n\t$apmsessiondomain\r\n\t\r\n\r\n\r\n"
            HTTP::respond 200 content $htmlStream "Content-Type" "text/xml" "Cache-Control" "no-cache, must-revalidate"
        }
    }
}

But my example is only getting explicit variables in the session, and then manually creating and spitting out the XML for it. Is there a method by which I can either a.) receive all the variables so I can loop through them building the XML stream, or b.) is there just a really neat function that will produce the XML output for me all together?

Anyone ever tried this yet or have an idea on where to get started?

3 Replies

  • Unfortunately there's no way (currently) to enumerate session variables within an iRule without knowing their specific name. You could, however, create a data group of all known session variables and simply loop through those in your iRule.
  • Yeah. That's where I was headed, if I couldn't figure this out.

     

     

    Cool, thanks!