Project

General

Profile

Feature #23502 ยป 15638_4-4.diff

Administrator Admin, 2010-09-04 03:13

View differences:

typo3/sysext/rsaauth/ext_autoload.php (Revision 0)
<?php
/*
* Register necessary class names with autoloader
*
* $Id$
*/
$extensionPath = t3lib_extMgm::extPath('rsaauth');
return array(
'tx_rsaauth_reports_status' => $extensionPath . 'utility/class.tx_rsaauth_reports_status.php',
);
?>
typo3/sysext/rsaauth/ext_localconf.php (Arbeitskopie)
)
);
// Add a reports provider to system extension reports
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers'][$_EXTKEY][] = 'tx_rsaauth_reports_status';
// Add a hook to the BE login form
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/index.php']['loginFormHook'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/hooks/class.tx_rsaauth_loginformhook.php:tx_rsaauth_loginformhook->getLoginFormTag';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/index.php']['loginScriptHook'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/hooks/class.tx_rsaauth_loginformhook.php:tx_rsaauth_loginformhook->getLoginScripts';
typo3/sysext/rsaauth/utility/class.tx_rsaauth_reports_status.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Marcus Krause <marcus#exp2010@t3sec.info>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project 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.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script 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 General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
* $Id$
*/
// TODO: remove if all rsaauth classes are registered at TYPO3 autoloader
require_once(t3lib_extMgm::extPath('rsaauth') . 'sv1/backends/class.tx_rsaauth_backendfactory.php');
require_once(t3lib_extMgm::extPath('rsaauth') . 'sv1/storage/class.tx_rsaauth_storagefactory.php');
/**
* A class which hooks into the backend module "Reports" checking whether
* prerequisites for this extension's usage are met.
*
* @author Marcus Krause <marcus#exp2010@t3sec.info>
* @package TYPO3
* @subpackage tx_rsaauth
*/
class tx_rsaauth_reports_status implements tx_reports_StatusProvider {
/**
* Keeps rsaauth status checks for system extension reports.
*
* @var array
*/
protected $reports = array();
/**
* Whether to skip checks that depend on working
* rsaauth backend.
*
* @var boolean
*/
protected $skipBackendDependentChecks = FALSE;
/**
* Class constructor.
*/
public function __construct() {
$this->reports['backendsShouldBeAvailable'] = $this->checkIfBackendFactoryDeliversBackend();
// execute check only if a rsaauth backend could be obtained
if (!$this->skipBackendDependentChecks) {
$this->reports['keysShouldBeGenerated'] = $this->checkIfKeyGenerationSucceeds();
}
// execute check only if rsaauth is installed as default storage uses a database table
if (t3lib_extMgm::isLoaded('rsaauth')) {
$this->reports['defaultStorageShouldPersistKeys'] = $this->checkIfDefaultStoragePersistsKeys();
}
}
/**
* Returns a compiled collection of rsaauth status checks as a status report.
*
* @return array
* @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
*/
public function getStatus() {
return $this->reports;
}
/**
* Check whether rsaauth backend factory delivers backend.
*
* @return tx_reports_reports_status_Status
*/
protected function checkIfBackendFactoryDeliversBackend() {
$backend = tx_rsaauth_backendfactory::getBackend();
if(is_object($backend)) {
$value = 'OK';
$message = 'A backend could be obtained';
$status = tx_reports_reports_status_Status::OK;
} else {
$value = t3lib_extMgm::isLoaded('rsaauth') ? 'ERROR' : 'WARNING';
$message = 'A backend could not be obtained. You won\'t be able to use system extension rsaauth. Please make sure you have at least PHP extension OpenSSL or OpenSSL binary available! Can be ignored if you do not intend to use rsaauth.';
$status = t3lib_extMgm::isLoaded('rsaauth') ? tx_reports_reports_status_Status::ERROR : tx_reports_reports_status_Status::WARNING;
$this->skipBackendDependentChecks = TRUE;
}
return t3lib_div::makeInstance('tx_reports_reports_status_Status',
'Backend Factory',
$value,
$message,
$status
);
}
/**
* Check whether rsaauth backend succeeds in key creation.
*
* @return tx_reports_reports_status_Status
*/
protected function checkIfKeyGenerationSucceeds() {
$backend = tx_rsaauth_backendfactory::getBackend();
// a storage should always be obtained as there's a default one
if(is_object($backend->createNewKeyPair())) {
$value = 'OK';
$message = 'Key creation successful';
$status = tx_reports_reports_status_Status::OK;
} else {
$value = t3lib_extMgm::isLoaded('rsaauth') ? 'ERROR' : 'WARNING';
$message = 'Key creation failed. You won\'t be able to use system extension rsaauth. Please make sure you have a working OpenSSL setup on your system! Can be ignored if you do not intend to use rsaauth.';
$status = t3lib_extMgm::isLoaded('rsaauth') ? tx_reports_reports_status_Status::ERROR : tx_reports_reports_status_Status::WARNING;
}
return t3lib_div::makeInstance('tx_reports_reports_status_Status',
'Key Creation',
$value,
$message,
$status
);
}
/**
* Check whether rsaauth storage persists keys.
*
* @return tx_reports_reports_status_Status
*/
protected function checkIfDefaultStoragePersistsKeys() {
$storage = tx_rsaauth_storagefactory::getStorage();
$data = 'LongerStringToBePersisted';
$storage->put($data);
// a storage should always be obtained as there's a default one
if(is_object($storage) && ($data === $storage->get())) {
$value = 'OK';
$message = 'Storage persists keys';
$status = tx_reports_reports_status_Status::OK;
} else {
$value = 'ERROR';
$message = 'Storage does not persist keys. You won\'t be able to use system extension rsaauth. Please make sure you have properly installed the extension! Can be ignored if you do not intend to use rsaauth';
$status = tx_reports_reports_status_Status::ERROR;
}
return t3lib_div::makeInstance('tx_reports_reports_status_Status',
'Key Storage',
$value,
$message,
$status
);
}
}
?>
    (1-1/1)