Forum Discussion
Adding session variable into Portal Access resouce header value
I have a portal resource access object working fine and passing the headers I assign. However when I try to insert a value of a session variable into the header value I do not get the actual session variable, but only the text I insert.
For example I know I have a session variable of session.logon.last.upn as a variable in the session (I have verified this during my active session), but when I input this into the header value I get "session.logon.last.upn" as the header not the actual upn value of the user.
I tried - session.logon.last.upn and %{session.logon.last.upn}.
Any help would be greatly appreciated.
- youssef1Cumulonimbus
Hello,
I asked you if you want to insert the header directly from your ressource (Portal access I supposed) or trough an Irule?
If you want to do it trouh an Irule is very simple, you just have to keep in mind that ACCESS_POLICY_AGENT_EVENT is used during APM policy evaluation. If you want to insert header to each request you can put the followin irule:
when HTTP_REQUEST { if {[ACCESS::policy equals "allow"]} { HTTP::header insert "usename" [ACCESS::session data get "session.logon.last.username"] log local0. "LOG INFO: [ACCESS::session data get "session.logon.last.username"]" } }
if ever, you can also use the event ACCESS_ACL_ALLOWED ( in every time a request is made )
when ACCESS_ACL_ALLOWED { set user [ACCESS::session data get "session.logon.last.username"] HTTP::header insert "usename" $user log local0. "LOG INFO: $user" }
Regards
- iaineNacreous
Hi
You have to use ACCESS::session to do this - see the last example on the wiki page - https://devcentral.f5.com/wiki/iRules.ACCESS__session.ashx - for an example.
- youssef1Cumulonimbus
Hello,
You insert the header directly from your ressource (Portal access I supposed) or trough an Irule?
Regards,
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com