Codeingiter - 仅用于某些路由的RESTful API密钥身份验证

时间:2015-11-17 12:53:10

标签: php codeigniter api rest

我正在构建RESTful API服务器。到目前为止,一切都在发挥作用。

我正在为CodeIgniter使用Phil Sturgeon RESTful服务器实现,这非常受欢迎。 https://github.com/chriskacerguis/codeigniter-restserver

我需要的是对此软件包已提供的某些路由进行基本API密钥身份验证,但它确实适用于所有API路由。

我不希望对所有路由进行身份验证..因为某些API应该在没有身份验证的情况下调用 我们如何实现它..

注意:我无法切换技术或框架,因为我目前正在使用之前开发并正在使用的模型。

例如没有验证的路线:$route['api/products'] = "api/Products/allProducts";

例如使用Auth路由:$route['api/devices/update'] = "api/Devices/updateDevice";

1 个答案:

答案 0 :(得分:3)

尝试:

$config['auth_override_class_method']['products']['allproducts'] = 'none';
$config['auth_override_class_method']['devices']['updatedevice'] = 'basic';