开发者

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

开发者 https://www.devze.com 2023-03-08 00:23 出处:网络
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

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

精彩评论

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