You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepeatingFilePasswordProvider.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch> and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.internal.transport.sshd;
  11. import org.apache.sshd.common.config.keys.FilePasswordProvider;
  12. /**
  13. * A {@link FilePasswordProvider} augmented to support repeatedly asking for
  14. * passwords.
  15. *
  16. */
  17. public interface RepeatingFilePasswordProvider extends FilePasswordProvider {
  18. /**
  19. * Define the maximum number of attempts to get a password that should be
  20. * attempted for one identity resource through this provider.
  21. *
  22. * @param numberOfPasswordPrompts
  23. * number of times to ask for a password;
  24. * {@link IllegalArgumentException} may be thrown if <= 0
  25. */
  26. void setAttempts(int numberOfPasswordPrompts);
  27. /**
  28. * Gets the maximum number of attempts to get a password that should be
  29. * attempted for one identity resource through this provider.
  30. *
  31. * @return the maximum number of attempts to try, always >= 1.
  32. */
  33. default int getAttempts() {
  34. return 1;
  35. }
  36. }