aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/ilias_auth.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /app/controllers/ilias_auth.php
current code from svn, revision 62608
Diffstat (limited to 'app/controllers/ilias_auth.php')
-rw-r--r--app/controllers/ilias_auth.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/app/controllers/ilias_auth.php b/app/controllers/ilias_auth.php
new file mode 100644
index 0000000..fd642dc
--- /dev/null
+++ b/app/controllers/ilias_auth.php
@@ -0,0 +1,52 @@
+<?php
+# Lifter007: TEST
+
+/**
+ * ilias_auth.php - authenticate ILIAS user
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * @author Arne Schroeder <schroeder@data-quest.de>
+ * @copyright 2018 Suchi & Berg GmbH <info@data-quest.de>
+ * @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;
+ $auth_status = StudipAuthAbstract::checkAuthentication(Request::get('login'), Request::get('password'));
+ if ($auth_status['uid']) {
+ $authenticated = true;
+ }
+ $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) {
+ $this->render_text('authenticated');
+ } else {
+ $this->render_nothing();
+ }
+ }
+}