NSExplorer
NSExplorer

Reputation: 12149

How to set up a Password-Protected Website to test HTTP authentication challenge?

I'm trying to test if my authentication code is working by testing it against a password protected website. How can I use the built in Apache server on the mac to create a test website so that I can test the connection:didReceiveAuthenticationChallenge delegate method? Are there any blogs/resources that show this?

Upvotes: 0

Views: 338

Answers (1)

stracktracer
stracktracer

Reputation: 1900

Do you mean the simple HTTP authentication? You can setup an Apache and create a .htaccess file in the protected directory with content

AuthType Basic
AuthName "Protected Area"
AuthUserFile .htpasswd
require valid-user

The file .htpasswd needs to have user and password info in syntax user:crypt(password) using the output generated by crypt.

Upvotes: 1

Related Questions