OAuth2.php 1019 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018-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\Auth\OAuth2;
  8. use OCA\Files_External\Lib\Auth\AuthMechanism;
  9. use OCA\Files_External\Lib\DefinitionParameter;
  10. use OCP\IL10N;
  11. /**
  12. * OAuth2 authentication
  13. */
  14. class OAuth2 extends AuthMechanism {
  15. public function __construct(IL10N $l) {
  16. $this
  17. ->setIdentifier('oauth2::oauth2')
  18. ->setScheme(self::SCHEME_OAUTH2)
  19. ->setText($l->t('OAuth2'))
  20. ->addParameters([
  21. (new DefinitionParameter('configured', 'configured'))
  22. ->setType(DefinitionParameter::VALUE_HIDDEN),
  23. new DefinitionParameter('client_id', $l->t('Client ID')),
  24. (new DefinitionParameter('client_secret', $l->t('Client secret')))
  25. ->setType(DefinitionParameter::VALUE_PASSWORD),
  26. (new DefinitionParameter('token', 'token'))
  27. ->setType(DefinitionParameter::VALUE_HIDDEN),
  28. ])
  29. ->addCustomJs('oauth2')
  30. ;
  31. }
  32. }