Forum Discussion
Jason_41583
Nimbostratus
May 12, 2013APM authentication User ID changed by application query
Hello all.
I have kind of strange situation that I am trying to sort out, we ahve an existing application that is going to use the APM for authentication but our problem is the existing a...
Jason_41583
Nimbostratus
May 17, 2013Thanks Kevin for all of the help you saved me at least a couple of weeks of trial and error. Below is the iRule that I have which I think is just about right - if you have a second please look it over and let me know if I should change anything.
Thanks again.
Jason
Irule:
when ACCESS_POLICY_AGENT_EVENT {
if { [ACCESS::policy agent_id] eq "change_username" } {
get client login
set SKlogin [ACCESS::session data get "session.logon.last.username"]
open the connection to SK-API
set conn [connect -timeout 100 -idle 30 -status conn_status 192.168.1.99:80]
log local0. "Lookup Log: Connection returns $conn and status $conn_status "
Now request the SamAccountName
!!for prod use real get string!! GET /api/security/GetADUsername?skUsername=$SK-login
set req "GET /$SKlogin HTTP/1.0\r\n\r\nConnection: Close\r\n\r\n"
log local0. "Request is: $req"
set send_info [send -timeout 200 -status send_status $conn $req]
log local0. "Send status is: $send_status"
set recv_data [recv -timeout 200 -status recv_status $conn]
log local0. "Recieve status: $recv_status and data: $recv_data"
close the connection
close $conn
find the payload after the response headers
set SAM [findstr $recv_data "user=" 5 " "]
create a new access session variable with the paylaod data
if { $SAM ne "" } {
Set a SamAccountName session variable to the value 'SAM'
ACCESS::session data set session.temp.username [string trim $SAM]
log local0. "SAM= $SAM"
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
