SFTP.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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('port', $l->t('Port')))
  22. ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
  23. (new DefinitionParameter('root', $l->t('Root')))
  24. ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
  25. ])
  26. ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
  27. ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY)
  28. ->setLegacyAuthMechanism($legacyAuth)
  29. ;
  30. }
  31. }