You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Here 'deals'and 'accounts' are controller names, 'view', 'insert' and 'user' are methods within. (NOTE: leave off the '_get' or '_post' from the end of the method name)
137
+
| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within. An asterisk may also be used to specify an authentication method for an entire classes methods. Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end of the method name)
135
138
| Acceptable values are; 'none', 'digest' and 'basic'.
<?phpdefined('BASEPATH') ORexit('No direct script access allowed');
2
+
3
+
/**
4
+
* Example
5
+
*
6
+
* This is a test for the wildcard .
7
+
*
8
+
* @package CodeIgniter
9
+
* @subpackage Rest Server
10
+
* @category Controller
11
+
* @author Allen Taylor
12
+
* @link http://philsturgeon.co.uk/code/
13
+
*/
14
+
15
+
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
16
+
17
+
/*
18
+
In order for this test to work you will need to change the auth_source option in the rest.php config file to '' and uncomment this line $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic'; in the file as well. Once these are uncommented the tests will work.
19
+
*/
20
+
requireAPPPATH.'/libraries/REST_Controller.php';
21
+
class Wildcard_test_cases extends REST_Controller{
22
+
function__construct(){
23
+
parent::__construct();
24
+
//set config for test
25
+
$this->config->load('rest');
26
+
$this->config->set_item('rest_auth', 'none');//turn on rest auth
27
+
$this->config->set_item('auth_source', '');//use config array for authentication
<?phpdefined('BASEPATH') ORexit('No direct script access allowed');
2
+
3
+
/**
4
+
* Example
5
+
*
6
+
* This is a test for the wildcard. Wildcard allows you to specify an authentication type rule for an entire controller. Example would be $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic'; This sets the authentication method for the Wildcard_test_harness controller to basic.
7
+
*
8
+
* @package CodeIgniter
9
+
* @subpackage Rest Server
10
+
* @category Controller
11
+
* @author Allen Taylor
12
+
* @link http://philsturgeon.co.uk/code/
13
+
*/
14
+
15
+
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
16
+
17
+
/*
18
+
In order for this test to work you will need to change the auth_source option in the rest.php config file to '' and uncomment this line $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic'; in the file as well. Once these are uncommented the tests will work.
These two test cases will test if the authentication is working for the wildcard method. The curl requests may not work if you do not have an .htaccess file with mod rewrite in the same directory as your index.php file. If you don't have that file you can add it or change the url below to the one that includes index.php.
0 commit comments