@@ -39,34 +39,34 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | class SessionCredentials extends AuthMechanism { |
| 41 | 41 | |
| 42 | - /** @var CredentialsStore */ |
|
| 43 | - private $credentialsStore; |
|
| 42 | + /** @var CredentialsStore */ |
|
| 43 | + private $credentialsStore; |
|
| 44 | 44 | |
| 45 | - public function __construct(IL10N $l, CredentialsStore $credentialsStore) { |
|
| 46 | - $this->credentialsStore = $credentialsStore; |
|
| 45 | + public function __construct(IL10N $l, CredentialsStore $credentialsStore) { |
|
| 46 | + $this->credentialsStore = $credentialsStore; |
|
| 47 | 47 | |
| 48 | - $this->setIdentifier('password::sessioncredentials') |
|
| 49 | - ->setScheme(self::SCHEME_PASSWORD) |
|
| 50 | - ->setText($l->t('Log-in credentials, save in session')) |
|
| 51 | - ->addParameters([]); |
|
| 52 | - } |
|
| 48 | + $this->setIdentifier('password::sessioncredentials') |
|
| 49 | + ->setScheme(self::SCHEME_PASSWORD) |
|
| 50 | + ->setText($l->t('Log-in credentials, save in session')) |
|
| 51 | + ->addParameters([]); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
| 55 | - try { |
|
| 56 | - $credentials = $this->credentialsStore->getLoginCredentials(); |
|
| 57 | - } catch (CredentialsUnavailableException $e) { |
|
| 58 | - throw new InsufficientDataForMeaningfulAnswerException('No session credentials saved'); |
|
| 59 | - } |
|
| 54 | + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
| 55 | + try { |
|
| 56 | + $credentials = $this->credentialsStore->getLoginCredentials(); |
|
| 57 | + } catch (CredentialsUnavailableException $e) { |
|
| 58 | + throw new InsufficientDataForMeaningfulAnswerException('No session credentials saved'); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - if ($credentials->getUID() !== $user->getUID()) { |
|
| 62 | - throw new StorageAuthException('Session credentials for storage owner not available'); |
|
| 63 | - } |
|
| 61 | + if ($credentials->getUID() !== $user->getUID()) { |
|
| 62 | + throw new StorageAuthException('Session credentials for storage owner not available'); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $storage->setBackendOption('user', $credentials->getLoginName()); |
|
| 66 | - $storage->setBackendOption('password', $credentials->getPassword()); |
|
| 67 | - } |
|
| 65 | + $storage->setBackendOption('user', $credentials->getLoginName()); |
|
| 66 | + $storage->setBackendOption('password', $credentials->getPassword()); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - public function wrapStorage(Storage $storage) { |
|
| 70 | - return new SessionStorageWrapper(['storage' => $storage]); |
|
| 71 | - } |
|
| 69 | + public function wrapStorage(Storage $storage) { |
|
| 70 | + return new SessionStorageWrapper(['storage' => $storage]); |
|
| 71 | + } |
|
| 72 | 72 | } |