* @copyright 2018 Suchi & Berg GmbH * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 * @category Stud.IP */ class IliasAuthController extends StudipController { /** * common tasks for all actions */ public function before_filter (&$action, &$args) { parent::before_filter($action, $args); } /** * check authentication */ public function authenticate_action() { $authenticated = false; $query = "SELECT external_user_token_valid_until FROM auth_extern WHERE external_user_name = ? AND external_user_token = ?"; $result = DBManager::get()->fetchOne($query, [Request::get('login'), Request::get('password')]); if (count($result)) { if ($result['external_user_token_valid_until'] > time()) { $authenticated = true; } } if (!$authenticated) { $auth_status = StudipAuthAbstract::checkAuthentication(Request::get('login'), Request::get('password')); if (!empty($auth_status['uid'])) { $authenticated = true; } } if ($authenticated) { $this->render_text('authenticated'); } else { $this->render_nothing(); } } }