Forum Discussion
Using irule get the name and value from HTML body
Hi Kevin,
Please advice on the above, i need to grap the saml token and post it to sp side.
when CLIENT_ACCEPTED { Get the defined pool for this VIP set default_pool [LB::server pool]
Set an initial lookup flag
set gotpath 1}
when HTTP_REQUEST {
log local0. "HTTP Method: [HTTP::method]"
set d2 [getfield [HTTP::host] "." 2]
set d3 [getfield [HTTP::host] "." 3]
set d4 [getfield [HTTP::host] "." 4]
set d5 [getfield [HTTP::host] "." 5]
set d6 [getfield [HTTP::host] "." 6]
set d7 [getfield [HTTP::host] "." 7]
set domain ""
foreach part "$d2 $d3 $d4 $d5 $d6 $d7" {
set domain [format "%s.%s" $domain $part]
}
set domain [domain [HTTP::host] 6]
log local0. "domain$domain"
On first request (lookup flag exists) perform lookup
if { $gotpath == 1 } {
Save the original request
set request [HTTP::request]
Change URI for sideband lookup
HTTP::uri "/iam/code.asp"
Change pool to point to sideband web service
pool Rachel_Test_208
}
if { $gotpath == 0 } {
HTTP::cookie insert name "SMSESSION" value $smsession path "/" domain $domain
log local0. "gotpath0 HTTP Method: [HTTP::method]"
HTTP::uri "/affwebservices/public/saml2sso?SPID=service_provider&ProtocolBinding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
}}
when HTTP_RESPONSE { If response from web service if { [HTTP::cookie exists "SMSESSION"] } { set smsession "[HTTP::cookie value SMSESSION]" log local0. "smsession$smsession" set gotpath 0 } if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 6048576}{ set content_length [HTTP::header "Content-Length"] } else { set content_length 6048576 } Check if $content_length is not set to 0 if { $content_length > 0} { log local0. "content_length$content_length" HTTP::collect $content_length } log local0. "payload[HTTP::payload]" }
when HTTP_RESPONSE_DATA { Full payload should be available here in [HTTP::payload] log local0. "payload[HTTP::payload]" log local0. "HTTP Method: [HTTP::method]"
if { [HTTP::payload] contains "SAMLResponse" }{
set requestpayload [HTTP::payload]
log local0. "requestpayload444$requestpayload"
log "substring value=[substr [HTTP::payload] 300 0]"
log local0. "findstr output: [findstr "$requestpayload" "=" 1 "zO"]"
foreach p [split [HTTP::payload] =] {
set name [URI::decode [getfield $p = 1]]
set value [URI::decode [getfield $p = 2]]
log local0. "name1$name"
log local0. "value1$value"
}
}}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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