TYPO3 CMS  TYPO3_6-2
RsaAuthService.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Rsaauth;
3 
17 // Include backends
28 
34  protected $backend = NULL;
35 
42  public $extKey = 'rsaauth';
43 
50  public $prefixId = 'tx_rsaauth_sv1';
51 
58  public $scriptRelPath = 'sv1/class.tx_rsaauth_sv1.php';
59 
68  public function processLoginData(array &$loginData, $passwordTransmissionStrategy) {
69  $isProcessed = FALSE;
70  if ($passwordTransmissionStrategy === 'rsa') {
73  // Decrypt the password
74  $password = $loginData['uident'];
75  $key = $storage->get();
76  if ($key != NULL && substr($password, 0, 4) === 'rsa:') {
77  // Decode password and store it in loginData
78  $decryptedPassword = $this->backend->decrypt($key, substr($password, 4));
79  if ($decryptedPassword !== NULL) {
80  $loginData['uident_text'] = $decryptedPassword;
81  $isProcessed = TRUE;
82  } else {
83  if ($this->pObj->writeDevLog) {
84  \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Process login data: Failed to RSA decrypt password', 'TYPO3\\CMS\\Rsaauth\\RsaAuthService');
85  }
86  }
87  // Remove the key
88  $storage->put(NULL);
89  } else {
90  if ($this->pObj->writeDevLog) {
91  \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Process login data: passwordTransmissionStrategy has been set to "rsa" but no rsa encrypted password has been found.', 'TYPO3\\CMS\\Rsaauth\\RsaAuthService');
92  }
93  }
94  }
95  return $isProcessed;
96  }
97 
103  public function init() {
104  $available = parent::init();
105  if ($available) {
106  // Get the backend
107  $this->backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend();
108  if (is_null($this->backend)) {
109  $available = FALSE;
110  }
111  }
112  return $available;
113  }
114 
115 }
static devLog($msg, $extKey, $severity=0, $dataVar=FALSE)
processLoginData(array &$loginData, $passwordTransmissionStrategy)