【发布时间】:2014-11-23 19:07:12
【问题描述】:
对不起我的英语。
我为我的新项目 API REST 测试 SLIM 框架。
我使用证书 SSL 在我的 Apache CGI 服务器上在线安装了 SLIM:好的,它可以工作!我可以从我的电脑访问我的资源(例如https://domaine.fr/v1/test)
我通过 htaccess 文件使用基本身份验证进行了测试。我录制用户/密码以访问我的资源:它有效!
现在,我想在 SLIM 中使用 https://github.com/tuupola/slim-basic-auth 进行基本身份验证测试
但它不起作用!它一直在问我登录名和密码!
我的 htaccess 文件:
Satisfy any
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
我的 index.php(苗条):
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->add(new \Slim\Middleware\HttpBasicAuthentication(array(
"realm" => "Here be dragons.",
"users" => array(
"root" => "t00r",
"test" => "test"
)
)));
我不明白为什么它不起作用。
谁能帮帮我?
谢谢
【问题讨论】:
-
浏览器询问时您输入的用户名和密码是什么?
-
我使用“root/t00r”或“test/test”。
标签: authentication slim