.htaccess - htaccess authentication rest api methods -
i have rest api service built using cakephp , need protect of methods using http authentication. example have methods like:
post /api/store { name: "john", surname: "johnny", ... } and want protect particular path (/api/store) protect http authentication call cron job
http://username:password@server.com/api/store is sth possible? if so, how? thank you!
we solved this. long url /api/store not physical path, need make different approach thank using basic http auth secured folder.
setenvif request_uri ^/api/store protected_method=true # need match url regex , set "protected_method" variable # commom auth authuserfile /absolute/path/to/directory/of/api authname "this method pwd protected" authtype basic order deny,allow deny satisfy require valid-user #check if requested url 1 of protected_method allow env=!protected_method
Comments
Post a Comment