Forum Discussion

ehergott_345008's avatar
ehergott_345008
Icon for Nimbostratus rankNimbostratus
Apr 06, 2018

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.

 

3 Replies

  • Hello,

     

    You insert the header directly from your ressource (Portal access I supposed) or trough an Irule?

     

    Regards,

     

  • 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