Authentication working with LDAP

This commit is contained in:
paolo
2016-04-11 17:23:51 +02:00
parent 55187700c2
commit 7032d8be7f
4 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ $autoload['packages'] = array();
*/
//$autoload['libraries'] = array();
$autoload['libraries'] = array('session', 'FHC_Auth');
$autoload['libraries'] = array('session', 'Fhcauth');
//$autoload['libraries'] = array();
$autoload['libraries'] = array('session');
+10 -7
View File
@@ -126,7 +126,7 @@ $config['rest_auth'] = 'basic';
| Note: If 'rest_auth' is set to 'session' then change 'auth_source' to the name of the session variable
|
*/
$config['auth_source'] = 'RestAPISession';
$config['auth_source'] = 'library';
/*
|--------------------------------------------------------------------------
@@ -144,7 +144,7 @@ $config['auth_source'] = 'RestAPISession';
| e.g: md5('admin:REST API:1234') = '1e957ebc35631ab22d5bd6526bd14ea2'
|
*/
$config['auth_library_class'] = 'FHCAuth';
$config['auth_library_class'] = 'fhcauth';
$config['auth_library_function'] = 'auth';
/*
@@ -163,7 +163,10 @@ $config['auth_library_function'] = 'auth';
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
| $config['auth_override_class_method']['dashboard']['*'] = 'none|digest|basic';
|
| 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)
| 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)
| Acceptable values are; 'none', 'digest' and 'basic'.
|
*/
@@ -196,10 +199,10 @@ $config['auth_library_function'] = 'auth';
| REST Login Usernames
|--------------------------------------------------------------------------
|
| Array of usernames and passwords for login, if ldap is configured this is ignored
| Array of usernames and passwords for login, if ldap (even library) is configured this is ignored
|
*/
$config['rest_valid_logins'] = ['admin' => '1234'];
$config['rest_valid_logins'] = ['admin' => '1234', 'test' => 'test'];
/*
|--------------------------------------------------------------------------
@@ -216,7 +219,7 @@ $config['rest_valid_logins'] = ['admin' => '1234'];
| restrict certain methods to IPs in your whitelist
|
*/
$config['rest_ip_whitelist_enabled'] = FALSE;
$config['rest_ip_whitelist_enabled'] = TRUE;
/*
|--------------------------------------------------------------------------
@@ -301,7 +304,7 @@ $config['rest_keys_table'] = 'ci_apikey';
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_keys'] = FALSE;
$config['rest_enable_keys'] = TRUE;
/*
|--------------------------------------------------------------------------
+4 -4
View File
@@ -23,7 +23,7 @@ if (! defined('BASEPATH'))
/**
* Handles user authentication and registration process
*/
class AuthAPI extends APIv1_Controller
class APIAuth extends APIv1_Controller
{
/**
* Userauth-Controller constructor.
@@ -42,7 +42,7 @@ class AuthAPI extends APIv1_Controller
// Load helper
//$this->load->helper('fhcauth');
$this->load->library('session');
$this->load->library('FHC_Auth');
$this->load->library('Fhcauth');
}
/**
@@ -60,8 +60,8 @@ class AuthAPI extends APIv1_Controller
$httpstatus = null;
$username = urldecode($this->get('username'));
$password = urldecode($this->get('password'));
$account = $this->FHCAuth->auth($username, $password);
$account = $this->fhcauth->auth($username, $password);
// perform login checks
if (!$account)
@@ -25,7 +25,7 @@ require_once FCPATH.'include/authentication.class.php';
// ------------------------------------------------------------------------
class FHC_Auth
class Fhcauth
{
/**
* Auth Username, Password over FH-Complete