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 04, 2015Hi Nitass,
Thank you, it worked!:
`when HTTP_REQUEST {
if {not ([string tolower [HTTP::uri]] contains "somepage.jsp")} {
return
}
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