开发者

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 pa开发者_JAVA百科ssword 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜