Forum Discussion
Yossi_100626
Nimbostratus
Jan 01, 2015Add basic authentication for specific page
Hi,
Will appreciate if anyone could explain what am I doing wrong.
I would like to protect a single specific page with basic authentication.
when HTTP_REQUEST {
if {[string tolower [HTTP::u...
Yossi_100626
Nimbostratus
Jan 01, 2015Nitass, thanks for trying to help. My aim is for the authentication to kick in only if a specific page was requested. Do you have any suggestions on how to make this work?
I made a small correction at the first stage:
when HTTP_REQUEST {
if {not [string tolower [HTTP::uri]] contains "somepage.jsp"} {
event disable all
return
}
My aim if for the following part to be executed only if the first part page was found
binary scan [ md5 [HTTP::password]] H* password
if { [class lookup "[HTTP::username]" authorized_users] equals $password } {
log local0. "User [HTTP::username] has been authorized to access virtual server [virtual name]"
} else {
if { [string length [HTTP::password]] != 0 } {
log local0. "User [HTTP::username] has been denied access to virtual server [virtual name]"
}
HTTP::respond 401 WWW-Authenticate "Basic realm=\"Secured Area\""
}
}
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