TYPO3 CMS  TYPO3_7-6
RsaAuthService.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Rsaauth;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
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.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
27 {
31  protected $rsaEncryptionDecoder = null;
32 
39  public $extKey = 'rsaauth';
40 
47  public $prefixId = 'tx_rsaauth_sv1';
48 
55  public $scriptRelPath = 'Classes/RsaAuthService.php';
56 
65  public function processLoginData(array &$loginData, $passwordTransmissionStrategy)
66  {
67  $isProcessed = false;
68  if ($passwordTransmissionStrategy === 'rsa') {
69  $password = $loginData['uident'];
70  if (substr($password, 0, 4) === 'rsa:') {
71  $decryptedPassword = $this->getRsaEncryptionDecoder()->decrypt($password);
72  if ($decryptedPassword !== $password) {
73  $loginData['uident_text'] = $decryptedPassword;
74  $isProcessed = true;
75  } else {
76  if ($this->pObj->writeDevLog) {
77  GeneralUtility::devLog('Process login data: Failed to RSA decrypt password', self::class);
78  }
79  }
80  } else {
81  if ($this->pObj->writeDevLog) {
82  GeneralUtility::devLog('Process login data: passwordTransmissionStrategy has been set to "rsa" but no rsa encrypted password has been found.', self::class);
83  }
84  }
85  }
86  return $isProcessed;
87  }
88 
94  public function init()
95  {
96  return parent::init() && $this->getRsaEncryptionDecoder()->isAvailable();
97  }
98 
102  protected function getRsaEncryptionDecoder()
103  {
104  if ($this->rsaEncryptionDecoder === null) {
105  $this->rsaEncryptionDecoder = GeneralUtility::makeInstance(RsaEncryptionDecoder::class);
106  }
107 
109  }
110 }
static devLog($msg, $extKey, $severity=0, $dataVar=false)
processLoginData(array &$loginData, $passwordTransmissionStrategy)