SFTP.php 1007 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files_External\Lib\Backend;
  8. use OCA\Files_External\Lib\Auth\AuthMechanism;
  9. use OCA\Files_External\Lib\Auth\Password\Password;
  10. use OCA\Files_External\Lib\DefinitionParameter;
  11. use OCP\IL10N;
  12. class SFTP extends Backend {
  13. public function __construct(IL10N $l, Password $legacyAuth) {
  14. $this
  15. ->setIdentifier('sftp')
  16. ->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
  17. ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
  18. ->setText($l->t('SFTP'))
  19. ->addParameters([
  20. new DefinitionParameter('host', $l->t('Host')),
  21. (new DefinitionParameter('root', $l->t('Root')))
  22. ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
  23. ])
  24. ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
  25. ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY)
  26. ->setLegacyAuthMechanism($legacyAuth)
  27. ;
  28. }
  29. }