Forum Discussion

Sajid's avatar
Sajid
Icon for Cirrostratus rankCirrostratus
Sep 05, 2019

Extract Username, Password and URL from External Posting

External posting for APM policy,

I have irule

 

when HTTP_REQUEST {

# Check for post requests to the fake URI

if {[HTTP::uri] starts_with "/login" && [HTTP::method] eq "POST"}{

    HTTP::cookie remove MRHSession

    ACCESS::session remove

# Collect up to 1Mb of request content

if { [HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] < 1048577 } {

set content_length [HTTP::header "Content-Length"]

} else {

set content_length 1048576

}

if { $content_length > 0 } {

HTTP::collect $content_length

}

}

}

 

when HTTP_REQUEST_DATA {

 

# Parse the username,password and URL from the collected payload

set username [URI::query "?[HTTP::payload]" username]

set password [URI::query [URI::decode "?[HTTP::payload]"] password]

set posturl "?[HTTP::payload]" url]

HTTP::release

}

 

when ACCESS_SESSION_STARTED {

if { [ info exists username ] } {

ACCESS::session data set session.logon.last.username $username

ACCESS::session data set -secure session.logon.last.password $password

ACCESS::session data set session.myurl.uri $posturl

}

}

 

this irule work very well with external posting (username/password), when try to add another field url.

It give auth fail due to password empty.

 

any suggestion.

 

No RepliesBe the first to reply