2 namespace TYPO3\CMS\Openid
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\CMS\Core\Utility\GeneralUtility
;
18 use TYPO3\CMS\Core\Utility\HttpUtility
;
21 * This class is the OpenID return script for the TYPO3 Frontend.
23 * @author Dmitry Dulepov <dmitry@typo3.org>
28 * Processes eID request.
32 public function main() {
33 // Due to the nature of OpenID (redrections, etc) we need to force user
34 // session fetching if there is no session around. This ensures that
35 // our service is called even if there is no login data in the request.
36 // Inside the service we will process OpenID response and authenticate
38 $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = TRUE
;
39 // Initialize Frontend user
40 \TYPO3\CMS\Frontend\Utility\EidUtility
::initFeUser();
41 // Redirect to the original location in any case (authenticated or not)
43 if ($this->getSignature(GeneralUtility
::_GP('tx_openid_location')) === GeneralUtility
::_GP('tx_openid_location_signature')) {
44 HttpUtility
::redirect(GeneralUtility
::_GP('tx_openid_location'), HttpUtility
::HTTP_STATUS_303
);
49 * Signs a GET parameter.
51 * @param string $parameter
54 protected function getSignature($parameter) {
55 return GeneralUtility
::hmac($parameter, 'openid');