.htaccess htaccess认证restapi方法
我使用CakePHP构建了RESTAPI服务,我需要使用http身份验证来保护我的一些方法。例如,我有如下方法:.htaccess htaccess认证restapi方法,.htaccess,rest,http,authentication,http-authentication,.htaccess,Rest,Http,Authentication,Http Authentication,我使用CakePHP构建了RESTAPI服务,我需要使用http身份验证来保护我的一些方法。例如,我有如下方法: POST /api/store { name: "John", surname: "Johnny", ... } 我想保护这个特定的路径(/api/store),通过http身份验证来调用cron作业 http://username:password@server.com/api/store 这样的事情可能吗?如果是,那怎么办?谢谢大家! 我们解决了这个问题。只
POST /api/store
{
name: "John",
surname: "Johnny",
...
}
我想保护这个特定的路径(/api/store),通过http身份验证来调用cron作业
http://username:password@server.com/api/store
这样的事情可能吗?如果是,那怎么办?谢谢大家! 我们解决了这个问题。只要url/api/store不是物理路径,我们就需要使用基本的http auth安全文件夹采用不同的方法
SetEnvIf Request_URI ^/api/store protected_method=true
# we need to match url with regex and set it to "protected_method" variable
# Commom auth
AuthUserFile /absolute/path/to/directory/of/api
AuthName "This method is pwd protected"
AuthType Basic
Order Deny,Allow
Deny from all
Satisfy any
Require valid-user
#check if requested url is one of protected_method
Allow from env=!protected_method