Skip to content
This repository was archived by the owner on Jul 18, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

Version 1.2
-------------
* fix compatibility issue with ownCloud 9.1

Version 0.1.1
-------------
* Added CSRF protection on setting form
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ Authors
* David Willinger (Leonis Holding) - https://github.com/leoniswebDAVe
* Florian Hintermeier (Leonis Holding) - https://github.com/leonisCacheFlo
* brenard - https://github.com/brenard
* Takayuki Nagai - https://github.com/nagai-takayuki

Links
-------
* Leonis Holding - http://www.leonis.at/
* Alysis & Leonis @ GitHub - https://github.com/alysisLeonis
* ownCloud - http://owncloud.org
* ownCloud @ GitHub - https://github.com/owncloud
* ownCloud @ GitHub - https://github.com/owncloud
13 changes: 6 additions & 7 deletions appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @author Sixto Martin <[email protected]>
* @copyright Sixto Martin Garcia. 2012
* @copyright Leonis. 2014 <[email protected]>
* @copyright Takayuki NAGAI 2016
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Expand Down Expand Up @@ -44,14 +45,13 @@
if( (isset($_GET['app']) && $_GET['app'] == 'user_cas') || $force_login ) {

if (OC_USER_CAS :: initialized_php_cas()) {

phpCAS::forceAuthentication();

if (!OC_User::login('', '')) {
$error = true;
\OCP\Util::writeLog('cas','Error trying to authenticate the user', \OCP\Util::DEBUG);
}
$user = phpCAS::getUser();
$application = new \OC\Core\Application();
$loginController = $application->getContainer()->query('LoginController');
$loginController->tryLogin($user,NULL,NULL);

if (isset($_SERVER["QUERY_STRING"]) && !empty($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != 'app=user_cas') {
header( 'Location: ' . OC::$WEBROOT . '/?' . $_SERVER["QUERY_STRING"]);
exit();
Expand All @@ -62,7 +62,6 @@
OC_Util::redirectToDefaultPage();
}


if (!phpCAS::isAuthenticated() && !OCP\User::isLoggedIn()) {
OC_App::registerLogIn(array('href' => '?app=user_cas', 'name' => 'CAS Login'));
}
Expand Down
6 changes: 3 additions & 3 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<name>CAS user and group backend</name>
<description>Authenticate Users by a CAS SERVER</description>
<licence>AGPL</licence>
<author>Leonis Holding</author>
<require>7.0.1</require>
<version>1.1</version>
<author>Takayuki NAGAI</author>
<require>9.1.0</require>
<version>1.2</version>
<types>
<prelogin/>
<authentication/>
Expand Down
5 changes: 3 additions & 2 deletions lib/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @author Sixto Martin <[email protected]>
* @copyright Sixto Martin Garcia. 2012
* @copyright Leonis. 2014 <[email protected]>
* @copyright Takayuki NAGAI 2016
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Expand All @@ -30,7 +31,7 @@ static public function post_login($parameters) {

$uid = $parameters['uid'];
$casBackend = OC_USER_CAS::getInstance();
$userDatabase = new OC_User_Database;
$userDatabase = new OC\User\Database;

if (phpCAS::isAuthenticated()) {
// $cas_attributes may vary in name, therefore attributes are fetched to $attributes
Expand Down Expand Up @@ -70,7 +71,7 @@ static public function post_login($parameters) {
return false;
}
else {
$random_password = OC_Util::generateRandomBytes(20);
$random_password = \OCP\Util::generateRandomBytes(20);
\OCP\Util::writeLog('cas','Creating new user: '.$uid, \OCP\Util::DEBUG);
$userDatabase->createUser($uid, $random_password);

Expand Down
21 changes: 11 additions & 10 deletions lib/ldap_backend_adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* @author Sixto Martin <[email protected]>
* @copyright Sixto Martin Garcia. 2012
* @copyright Takayuki NAGAI 2016
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Expand All @@ -29,10 +30,9 @@
* This class come from another owncloud plugins : https://github.com/AndreasErgenzinger/user_shibboleth
*/


namespace OCA\user_cas\lib;

class LdapBackendAdapter extends \OCA\user_ldap\USER_LDAP {
class LdapBackendAdapter extends \OCA\User_LDAP\User_LDAP {

private $enabled;
private $connected = false;
Expand All @@ -49,21 +49,22 @@ function __construct() {

private function connect() {
if (!$this->connected) {
$helper = new \OCA\user_ldap\lib\Helper();
$helper = new \OCA\User_LDAP\Helper();
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$this->ldap = new \OCA\user_ldap\lib\LDAP();
$this->ldap = new \OCA\User_LDAP\LDAP();
$dbc = \OC::$server->getDatabaseConnection();
$this->usermanager = new \OCA\user_ldap\lib\user\Manager(
$this->usermanager = new \OCA\User_LDAP\User\Manager(
\OC::$server->getConfig(),
new \OCA\user_ldap\lib\FilesystemHelper(),
new \OCA\user_ldap\lib\LogWrapper(),
new \OCA\User_LDAP\FilesystemHelper(),
new \OCA\User_LDAP\LogWrapper(),
\OC::$server->getAvatarManager(),
new \OCP\Image(),
$dbc
$dbc,
\OC::$server->getUserManager()
);
$this->connection = new \OCA\user_ldap\lib\Connection($this->ldap,$configPrefixes[0]);
$this->connection = new \OCA\User_LDAP\Connection($this->ldap,$configPrefixes[0]);

$this->access = new \OCA\user_ldap\lib\Access($this->connection, $this->ldap, $this->usermanager);
$this->access = new \OCA\User_LDAP\Access($this->connection, $this->ldap, $this->usermanager);

$this->access->setUserMapper(new \OCA\User_LDAP\Mapping\UserMapping($dbc));
$this->access->setGroupMapper(new \OCA\User_LDAP\Mapping\GroupMapping($dbc));
Expand Down
2 changes: 1 addition & 1 deletion user_cas.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*/

#require_once(__DIR__ . '/lib/ldap_backend_adapter.php'); // Not required in 8.2, we now have an autoloader
require_once(__DIR__ . '/lib/ldap_backend_adapter.php');
use OCA\user_cas\lib\LdapBackendAdapter;

class OC_USER_CAS extends OC_User_Backend {
Expand Down