diff --git a/core/src/plugins/auth.cas/class.casAuthDriver.php b/core/src/plugins/auth.cas/class.casAuthDriver.php
deleted file mode 100644
index bbb83e4bef..0000000000
--- a/core/src/plugins/auth.cas/class.casAuthDriver.php
+++ /dev/null
@@ -1,78 +0,0 @@
-
- * This file is part of Pydio.
- *
- * Pydio is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Pydio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Pydio. If not, see .
- *
- * The latest code can be found at .
- */
-defined('AJXP_EXEC') or die( 'Access not allowed');
-
-require_once 'CAS.php';
-
-/**
- * AJXP_Plugin to authenticate users against CAS Single sign-on mechanism
- * @package AjaXplorer_Plugins
- * @subpackage Auth
- */
-class casAuthDriver extends serialAuthDriver
-{
- private $cas_server;
- private $cas_port;
- private $cas_uri;
-
- public function init($options)
- {
- parent::init($options);
- $this->cas_server = $this->getOption("CAS_SERVER");
- $this->cas_port = $this->getOption("CAS_PORT");
- $this->cas_uri = $this->getOption("CAS_URI");
- phpCAS::client(CAS_VERSION_1_0, $this->cas_server, $this->cas_port, $this->cas_uri, false);
- phpCAS::setNoCasServerValidation();
- }
-
- public function usersEditable()
- {
- return false;
- }
-
- public function passwordsEditable()
- {
- return false;
- }
-
- public function preLogUser($sessionId)
- {
- if ($_GET['get_action'] == "logout") {
- phpCAS::logout();
- return;
- }
- phpCAS::forceAuthentication();
- $cas_user = phpCAS::getUser();
-
- if (!$this->userExists($cas_user) && $this->autoCreateUser())
- $this->createUser($cas_user, openssl_random_pseudo_bytes(20));
-
- if ($this->userExists($cas_user))
- AuthService::logUser($cas_user, "", true);
- }
-
- public function getLogoutRedirect()
- {
- $_SESSION = array();
- session_destroy();
- return phpCAS::getServerLogoutURL();
- }
-}
diff --git a/core/src/plugins/auth.cas/manifest.xml b/core/src/plugins/auth.cas/manifest.xml
deleted file mode 100644
index 349f883671..0000000000
--- a/core/src/plugins/auth.cas/manifest.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- Ultreia Communicaciones
- http://pyd.io/plugins/auth/cas
- 1.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/core/src/plugins/auth.cas/CAS.php b/core/src/plugins/authfront.cas/CAS.php
old mode 100644
new mode 100755
similarity index 99%
rename from core/src/plugins/auth.cas/CAS.php
rename to core/src/plugins/authfront.cas/CAS.php
index 71a16bb2fc..ba63d4c851
--- a/core/src/plugins/auth.cas/CAS.php
+++ b/core/src/plugins/authfront.cas/CAS.php
@@ -302,7 +302,7 @@
// ########################################################################
// include client class
-include_once (dirname(__FILE__) . '/CAS/Client.php');
+include_once(dirname(__FILE__) . '/CAS/Client.php');
// ########################################################################
// INTERFACE CLASS
diff --git a/core/src/plugins/auth.cas/CAS/Client.php b/core/src/plugins/authfront.cas/CAS/Client.php
old mode 100644
new mode 100755
similarity index 98%
rename from core/src/plugins/auth.cas/CAS/Client.php
rename to core/src/plugins/authfront.cas/CAS/Client.php
index 116d3199f5..82e2bd2a6c
--- a/core/src/plugins/auth.cas/CAS/Client.php
+++ b/core/src/plugins/authfront.cas/CAS/Client.php
@@ -35,26 +35,26 @@
*/
// include internationalization stuff
-include_once(dirname(__FILE__).'/languages/languages.php');
+include_once(dirname(__FILE__) . '/languages/languages.php');
// include PGT storage classes
-include_once(dirname(__FILE__).'/PGTStorage/AbstractStorage.php');
+include_once(dirname(__FILE__) . '/PGTStorage/AbstractStorage.php');
// include class for storing service cookies.
-include_once(dirname(__FILE__).'/CookieJar.php');
+include_once(dirname(__FILE__) . '/CookieJar.php');
// include class for fetching web requests.
-include_once(dirname(__FILE__).'/Request/CurlRequest.php');
+include_once(dirname(__FILE__) . '/Request/CurlRequest.php');
// include classes for proxying access to services
-include_once(dirname(__FILE__).'/ProxiedService/Http/Get.php');
-include_once(dirname(__FILE__).'/ProxiedService/Http/Post.php');
-include_once(dirname(__FILE__).'/ProxiedService/Imap.php');
+include_once(dirname(__FILE__) . '/ProxiedService/Http/Get.php');
+include_once(dirname(__FILE__) . '/ProxiedService/Http/Post.php');
+include_once(dirname(__FILE__) . '/ProxiedService/Imap.php');
// include Exception classes
-include_once(dirname(__FILE__).'/ProxiedService/Exception.php');
-include_once(dirname(__FILE__).'/ProxyTicketException.php');
-include_once(dirname(__FILE__).'/InvalidArgumentException.php');
+include_once(dirname(__FILE__) . '/ProxiedService/Exception.php');
+include_once(dirname(__FILE__) . '/ProxyTicketException.php');
+include_once(dirname(__FILE__) . '/InvalidArgumentException.php');
/**
@@ -1146,7 +1146,7 @@ public function isAuthenticated()
header('Location: '.$this->getURL());
phpCAS::trace( "Prepare redirect to : ".$this->getURL() );
phpCAS::traceExit();
- exit();
+ //exit();
}
}
}
@@ -1271,6 +1271,7 @@ public function redirectToCas($gateway=false,$renew=false){
* @params $params an array that contains the optional url and service parameters that will be passed to the CAS server
*/
public function logout($params) {
+ $res = array();
phpCAS::traceBegin();
$cas_url = $this->getServerLogoutURL();
$paramSeparator = '?';
@@ -1281,16 +1282,34 @@ public function logout($params) {
if (isset($params['service'])) {
$cas_url = $cas_url . $paramSeparator . "service=" . urlencode($params['service']);
}
- header('Location: '.$cas_url);
- phpCAS::trace( "Prepare redirect to : ".$cas_url );
+
+ flush();
+ error_reporting(E_ALL);
+ ini_set('display_errors','On');
+ ob_start(null, 0, PHP_OUTPUT_HANDLER_STDFLAGS ^ PHP_OUTPUT_HANDLER_REMOVABLE);
+ header('Refresh: 5; url='.$cas_url);
+ die();
+ phpCAS::trace( "Prepare redirect logout to : ".$cas_url );
session_unset();
session_destroy();
+ /*
+ *
+ *
+ *
+ * */
+
$this->printHTMLHeader($this->getString(CAS_STR_LOGOUT));
printf('
'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'
',$cas_url);
$this->printHTMLFooter();
+
+ $loggingResult = 2;
+ AJXP_XMLWriter::header();
+ AJXP_XMLWriter::loggingResult($loggingResult, null, null, null);
+ AJXP_XMLWriter::close();
+
phpCAS::traceExit();
exit();
}
diff --git a/core/src/plugins/auth.cas/CAS/CookieJar.php b/core/src/plugins/authfront.cas/CAS/CookieJar.php
old mode 100644
new mode 100755
similarity index 99%
rename from core/src/plugins/auth.cas/CAS/CookieJar.php
rename to core/src/plugins/authfront.cas/CAS/CookieJar.php
index b45daba326..ecde6c9fd4
--- a/core/src/plugins/auth.cas/CAS/CookieJar.php
+++ b/core/src/plugins/authfront.cas/CAS/CookieJar.php
@@ -28,7 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-include_once(dirname(__FILE__).'/InvalidArgumentException.php');
+include_once(dirname(__FILE__) . '/InvalidArgumentException.php');
/**
* This class provides access to service cookies and handles parsing of response
diff --git a/core/src/plugins/auth.cas/CAS/Exception.php b/core/src/plugins/authfront.cas/CAS/Exception.php
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/CAS/Exception.php
rename to core/src/plugins/authfront.cas/CAS/Exception.php
diff --git a/core/src/plugins/auth.cas/CAS/InvalidArgumentException.php b/core/src/plugins/authfront.cas/CAS/InvalidArgumentException.php
old mode 100644
new mode 100755
similarity index 97%
rename from core/src/plugins/auth.cas/CAS/InvalidArgumentException.php
rename to core/src/plugins/authfront.cas/CAS/InvalidArgumentException.php
index 1a61fb284a..b3208da0ea
--- a/core/src/plugins/auth.cas/CAS/InvalidArgumentException.php
+++ b/core/src/plugins/authfront.cas/CAS/InvalidArgumentException.php
@@ -28,7 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-require_once(dirname(__FILE__).'/Exception.php');
+require_once(dirname(__FILE__) . '/Exception.php');
/**
* Exception that denotes invalid arguments were passed.
diff --git a/core/src/plugins/auth.cas/CAS/LICENSE.txt b/core/src/plugins/authfront.cas/CAS/LICENSE.txt
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/CAS/LICENSE.txt
rename to core/src/plugins/authfront.cas/CAS/LICENSE.txt
diff --git a/core/src/plugins/auth.cas/CAS/OutOfSequenceException.php b/core/src/plugins/authfront.cas/CAS/OutOfSequenceException.php
old mode 100644
new mode 100755
similarity index 97%
rename from core/src/plugins/auth.cas/CAS/OutOfSequenceException.php
rename to core/src/plugins/authfront.cas/CAS/OutOfSequenceException.php
index a88d08cc04..d37d6f98fd
--- a/core/src/plugins/auth.cas/CAS/OutOfSequenceException.php
+++ b/core/src/plugins/authfront.cas/CAS/OutOfSequenceException.php
@@ -28,7 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-require_once(dirname(__FILE__).'/Exception.php');
+require_once(dirname(__FILE__) . '/Exception.php');
/**
* This class defines Exceptions that should be thrown when the sequence of operations
diff --git a/core/src/plugins/auth.cas/CAS/PGTStorage/AbstractStorage.php b/core/src/plugins/authfront.cas/CAS/PGTStorage/AbstractStorage.php
old mode 100644
new mode 100755
similarity index 98%
rename from core/src/plugins/auth.cas/CAS/PGTStorage/AbstractStorage.php
rename to core/src/plugins/authfront.cas/CAS/PGTStorage/AbstractStorage.php
index e6bedbf647..d5c9550796
--- a/core/src/plugins/auth.cas/CAS/PGTStorage/AbstractStorage.php
+++ b/core/src/plugins/authfront.cas/CAS/PGTStorage/AbstractStorage.php
@@ -209,7 +209,7 @@ function read($pgt_iou)
}
// include specific PGT storage classes
-include_once(dirname(__FILE__).'/Db.php');
-include_once(dirname(__FILE__).'/File.php');
+include_once(dirname(__FILE__) . '/Db.php');
+include_once(dirname(__FILE__) . '/File.php');
?>
\ No newline at end of file
diff --git a/core/src/plugins/auth.cas/CAS/PGTStorage/Db.php b/core/src/plugins/authfront.cas/CAS/PGTStorage/Db.php
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/CAS/PGTStorage/Db.php
rename to core/src/plugins/authfront.cas/CAS/PGTStorage/Db.php
diff --git a/core/src/plugins/auth.cas/CAS/PGTStorage/File.php b/core/src/plugins/authfront.cas/CAS/PGTStorage/File.php
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/CAS/PGTStorage/File.php
rename to core/src/plugins/authfront.cas/CAS/PGTStorage/File.php
diff --git a/core/src/plugins/auth.cas/CAS/ProxiedService.php b/core/src/plugins/authfront.cas/CAS/ProxiedService.php
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/CAS/ProxiedService.php
rename to core/src/plugins/authfront.cas/CAS/ProxiedService.php
diff --git a/core/src/plugins/auth.cas/CAS/ProxiedService/Abstract.php b/core/src/plugins/authfront.cas/CAS/ProxiedService/Abstract.php
old mode 100644
new mode 100755
similarity index 94%
rename from core/src/plugins/auth.cas/CAS/ProxiedService/Abstract.php
rename to core/src/plugins/authfront.cas/CAS/ProxiedService/Abstract.php
index d05628a4a7..0efb355672
--- a/core/src/plugins/auth.cas/CAS/ProxiedService/Abstract.php
+++ b/core/src/plugins/authfront.cas/CAS/ProxiedService/Abstract.php
@@ -28,10 +28,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-require_once(dirname(__FILE__).'/../ProxiedService.php');
-require_once(dirname(__FILE__).'/Testable.php');
-include_once(dirname(__FILE__).'/../InvalidArgumentException.php');
-include_once(dirname(__FILE__).'/../OutOfSequenceException.php');
+require_once(dirname(__FILE__) . '/../ProxiedService.php');
+require_once(dirname(__FILE__) . '/Testable.php');
+include_once(dirname(__FILE__) . '/../InvalidArgumentException.php');
+include_once(dirname(__FILE__) . '/../OutOfSequenceException.php');
/**
diff --git a/core/src/plugins/auth.cas/CAS/ProxiedService/Exception.php b/core/src/plugins/authfront.cas/CAS/ProxiedService/Exception.php
old mode 100644
new mode 100755
similarity index 97%
rename from core/src/plugins/auth.cas/CAS/ProxiedService/Exception.php
rename to core/src/plugins/authfront.cas/CAS/ProxiedService/Exception.php
index ffeaa552c3..6cf71a00cc
--- a/core/src/plugins/auth.cas/CAS/ProxiedService/Exception.php
+++ b/core/src/plugins/authfront.cas/CAS/ProxiedService/Exception.php
@@ -28,7 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-require_once(dirname(__FILE__).'/../Exception.php');
+require_once(dirname(__FILE__) . '/../Exception.php');
/**
* An Exception for problems communicating with a proxied service.
diff --git a/core/src/plugins/auth.cas/CAS/ProxiedService/Http.php b/core/src/plugins/authfront.cas/CAS/ProxiedService/Http.php
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/CAS/ProxiedService/Http.php
rename to core/src/plugins/authfront.cas/CAS/ProxiedService/Http.php
diff --git a/core/src/plugins/auth.cas/CAS/ProxiedService/Http/Abstract.php b/core/src/plugins/authfront.cas/CAS/ProxiedService/Http/Abstract.php
old mode 100644
new mode 100755
similarity index 95%
rename from core/src/plugins/auth.cas/CAS/ProxiedService/Http/Abstract.php
rename to core/src/plugins/authfront.cas/CAS/ProxiedService/Http/Abstract.php
index c60b57966b..95bcaa16b9
--- a/core/src/plugins/auth.cas/CAS/ProxiedService/Http/Abstract.php
+++ b/core/src/plugins/authfront.cas/CAS/ProxiedService/Http/Abstract.php
@@ -1,6 +1,6 @@
+ * This file is part of Pydio.
+ *
+ * Pydio is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Pydio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Pydio. If not, see .
+ *
+ * The latest code can be found at .
+ */
+defined('AJXP_EXEC') or die('Access not allowed');
+
+require_once 'CAS.php';
+
+class CasAuthFrontend extends AbstractAuthFrontend
+{
+
+ private $cas_server;
+ private $cas_port;
+ private $cas_uri;
+ private $is_AutoCreateUser;
+ private $cas_logoutUrl;
+ private $forceRedirect;
+
+
+ function tryToLogUser($httpVars, $isLast = false)
+ {
+ if (isset($this->pluginConf["CAS_SERVER"])) {
+ $this->cas_server = $this->pluginConf["CAS_SERVER"];
+ }
+
+ if (isset($this->pluginConf["CAS_PORT"])) {
+ $this->cas_port = intval($this->pluginConf["CAS_PORT"]);
+ }
+
+ if (isset($this->pluginConf["CAS_URI"])) {
+ $this->cas_uri = $this->pluginConf["CAS_URI"];
+ }
+
+ if (isset($this->pluginConf["CREATE_USER"])) {
+ $this->is_AutoCreateUser = ($this->pluginConf["CREATE_USER"] == "true");
+ }
+
+ if (isset($this->pluginConf["LOGOUT_URL"])) {
+ $this->cas_logoutUrl = $this->pluginConf["LOGOUT_URL"];
+ }
+
+ if (isset($this->pluginConf["FORCE_REDIRECT"])) {
+ $this->forceRedirect = $this->pluginConf["FORCE_REDIRECT"];
+ }
+
+ phpCAS::setDebug(AJXP_DATA_PATH . "/logs/debug.log");
+ if ($GLOBALS['PHPCAS_CLIENT'] == null) {
+ phpCAS::client(CAS_VERSION_2_0, $this->cas_server, $this->cas_port, $this->cas_uri, false);
+ }
+ phpCAS::setNoCasServerValidation();
+ AJXP_Logger::debug(__FUNCTION__, "Call forceAuthentication ", "");
+
+ if($this->forceRedirect) {
+ // if forceRedirect is enable, redirect webpage to CAS web to do the authentication.
+ // After login successfully, CAS will go back to pydio webpage.
+ phpCAS::forceAuthentication();
+ }else{
+ // Otherwise, verify user has already logged by using CAS or not?
+ if(!phpCAS::isAuthenticated()){
+ // In case of NO, return false to bypass the authentication by CAS and continue to use another method
+ // in authfront list.
+ return false;
+ }
+ }
+
+ AJXP_Logger::debug(__FUNCTION__, "Call phpCAS::getUser() after forceAuthentication ", "");
+ $cas_user = phpCAS::getUser();
+ if (!AuthService::userExists($cas_user) && $this->is_AutoCreateUser) {
+ AuthService::createUser($cas_user, openssl_random_pseudo_bytes(20));
+ }
+ if (AuthService::userExists($cas_user)) {
+ $res = AuthService::logUser($cas_user, "", true);
+ if ($res > 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function logOutCAS($action, $httpVars, $fileVars)
+ {
+ if (!isSet($this->actions[$action])) return;
+
+ switch ($action) {
+ case "logoutCAS":
+ AuthService::disconnect();
+ AJXP_XMLWriter::header("url");
+ echo $this->pluginConf["LOGOUT_URL"];
+ AJXP_XMLWriter::close("url");
+ session_unset();
+ session_destroy();
+ break;
+ default:
+ break;
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/src/plugins/auth.cas/i18n/conf/es.php b/core/src/plugins/authfront.cas/i18n/conf/es.php
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/i18n/conf/es.php
rename to core/src/plugins/authfront.cas/i18n/conf/es.php
diff --git a/core/src/plugins/authfront.cas/logoutCAS.png b/core/src/plugins/authfront.cas/logoutCAS.png
new file mode 100755
index 0000000000..bb265c2d1c
Binary files /dev/null and b/core/src/plugins/authfront.cas/logoutCAS.png differ
diff --git a/core/src/plugins/authfront.cas/manifest.xml b/core/src/plugins/authfront.cas/manifest.xml
new file mode 100755
index 0000000000..2c13fa8a4c
--- /dev/null
+++ b/core/src/plugins/authfront.cas/manifest.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/plugins/auth.cas/plugin_doc.html b/core/src/plugins/authfront.cas/plugin_doc.html
old mode 100644
new mode 100755
similarity index 100%
rename from core/src/plugins/auth.cas/plugin_doc.html
rename to core/src/plugins/authfront.cas/plugin_doc.html