Forum Discussion
ssenecal_87343
Nimbostratus
Nov 09, 2009Authentication using a REST WebService
Does anyone know any trick to simulate HTTP::geturl in an HTTP_REQUEST event? I need to perform OpenSSO token validation in an iRule, but I can't figure out how to check the validity of an incoming token.
Below is what I am trying to do, but obviously the HTTP:geturl section doesn't compile. Any help would be appreciated!
Shaun
when CLIENT_ACCEPTED {
set forceauth 1
set ckname iPlanetDirectoryPro
}
when HTTP_REQUEST {
if {[HTTP::cookie exists $ckname]} {
verify the token is valid
set resp [HTTP::geturl "https://opensso.server.com/opensso/identity/isTokenValid?tokenid=" [HTTP::cookie value $ckname]]
if {$resp eq "boolean=true"} {
set forceauth 0
}
}
if {$forceauth eq 1} {
redirect the user to the OpenSSO server for authentication
HTTP::respond 302 Location "https://opensso.server.com/opensso/UI/Login?goto=" [URI::encode HTTP::uri]
}
}
8 Replies
Sort By
- hoolio
Cirrostratus
You can use HTTP::retry to make a new HTTP request. Deb posted a helpful article on this a while back: - ssenecal_87343
Nimbostratus
Thanks! This looks like it should work just fine. Also, thanks for the tip on the strings as well. My TCL is more than rusty! - ssenecal_87343
Nimbostratus
I have this implemented, and its "starting" to work except that I am constantly getting LB_FAILED. I'm hoping someone can point me to some obvious things to check. Below is the relevant bit of the iRule - hoolio
Cirrostratus
As a test, you could try removing the iRule from the VIP and configuring the OpenSSO pool as the VIP's default pool. Once the load balancing to the OpenSSO pool is working, you could start testing the iRule again. If the OpenSSO pool members don't have LTM as their default gateway you would want to enable SNAT on the VIP to ensure the responses come back to LTM. - ssenecal_87343
Nimbostratus
Thanks Aaron. That is exactly what we did last week and found out we had forgotten to assign an SNAT pool. Once that was done, things were working smoothly. Once I get everything working I will post the final iRule so that anyone else wanting to authenticate traffic against OpenSSO can use it. - hoolio
Cirrostratus
Sounds good. - ssenecal_87343
Nimbostratus
For anyone that is interested, I have posted my current version of the "F5 BIG-IP Policy Agent" at http://devcentral.f5.com/wiki/default.aspx/iRules/OpenSSO_authentication.html. It merely ensures that incoming HTTP traffic has been authenticated against the OpenSSO server before passing the request on. - hoolio
Cirrostratus
That's a nice addition. Thanks for posting it.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects