- Removed method getCheckUserAuth form api/v1/CheckUserAuth

- Changed LDAP_Model to a library: LDAPLib
- Removed controller system/Login

AuthLib:
- Added new private method _createAuthObjByPerson
- Moved config load from constructor to _authenticate
- Moved Person_Model load from constructor to _createAuthObjByPerson
- Removed method checkUserAuthByCode
- Removed method checkUserAuthByCodeEmail
- Adapted code to use LDAPLib
This commit is contained in:
Paolo
2019-03-13 11:57:36 +01:00
parent fd9a2266ec
commit 53a0b60ba8
5 changed files with 100 additions and 237 deletions
@@ -35,45 +35,4 @@ class CheckUserAuth extends REST_Controller
$this->response();
}
}
/**
* Checks if username and password of a final user are valid
* Returns all the keys with which is possible to obtain all the personal data about a final user
*/
public function getCheckUserAuth()
{
$code = $this->get('code');
$email = $this->get('email');
$username = $this->get('username');
$password = $this->get('password');
$result = null;
$httpCode = null;
// If username and password are given then check authentication using them
if (isset($username) && isset($password))
{
$result = $this->authlib->checkUserAuthByUsernamePassword($username, $password, true);
}
elseif (isset($code) || isset($email))
{
// If code and email are given then check authentication using them
if (isset($code) && isset($email))
{
$result = $this->authlib->checkUserAuthByCodeEmail($code, $email);
}
else // otherwise check authentication using only code
{
$result = $this->authlib->checkUserAuthByCode($code);
}
}
// If is a success and contains data
if (hasData($result))
{
$httpCode = REST_Controller::HTTP_OK;
}
$this->response($result, $httpCode);
}
}