PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/projects/eclipse_SDK-3.7.1/plugins/org.eclipse.team.cvs.core.source_3.3.400.I20110510-0800/org/eclipse/team/internal/ccvs/core/IUserAuthenticator.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 152 lines | 18 code | 16 blank | 118 comment | 0 complexity | a1360e48f2dd94e9fd7850b210b6d4d9 MD5 | raw file
  1. /*******************************************************************************
  2. * Copyright (c) 2000, 2007 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. * Atsuhiko Yamanaka, JCraft,Inc. - adding promptForKeyboradInteractive method
  11. *******************************************************************************/
  12. package org.eclipse.team.internal.ccvs.core;
  13. import java.util.Map;
  14. /**
  15. * IUserAuthenticators are used to ensure that the user
  16. * is validated for access to a given repository. The
  17. * user is prompted for a username and password as
  18. * appropriate for the given repository type.
  19. */
  20. public interface IUserAuthenticator {
  21. /**
  22. * Button id for an "Ok" button (value 0).
  23. */
  24. public int OK_ID = 0;
  25. /**
  26. * Button id for a "Cancel" button (value 1).
  27. */
  28. public int CANCEL_ID = 1;
  29. /**
  30. * Button id for a "Yes" button (value 2).
  31. */
  32. public int YES_ID = 2;
  33. /**
  34. * Button id for a "No" button (value 3).
  35. */
  36. public int NO_ID = 3;
  37. /**
  38. * Constant for a prompt with no type (value 0).
  39. */
  40. public final static int NONE = 0;
  41. /**
  42. * Constant for an error prompt (value 1).
  43. */
  44. public final static int ERROR = 1;
  45. /**
  46. * Constant for an information prompt (value 2).
  47. */
  48. public final static int INFORMATION = 2;
  49. /**
  50. * Constant for a question prompt (value 3).
  51. */
  52. public final static int QUESTION = 3;
  53. /**
  54. * Constant for a warning dialog (value 4).
  55. */
  56. public final static int WARNING = 4;
  57. /**
  58. * Authenticates the user for access to a given repository.
  59. * The obtained values for user name and password will be placed
  60. * into the supplied user info object. Implementors are allowed to
  61. * save user names and passwords. The user should be prompted for
  62. * user name and password if there is no saved one, or if <code>retry</code>
  63. * is <code>true</code>.
  64. *
  65. * @param location The repository location to authenticate the user for or <code>null</code>
  66. * if this authentication is not for a CVS repository location.
  67. * @param info The object to place user validation information into.
  68. * @param retry <code>true</code> if a previous attempt to log in failed.
  69. * @param message An optional message to display if, e.g., previous authentication failed.
  70. * @return true if the validation was successful, and false otherwise.
  71. */
  72. public void promptForUserInfo(ICVSRepositoryLocation location, IUserInfo userInfo, String message) throws CVSException;
  73. /**
  74. * Prompts the user for a number values using text fields. The labels are provided in
  75. * the <core>prompt</code> array. Implementors will return the entered values, or null if
  76. * the user cancel the prompt.
  77. *
  78. * @param location The repository location to authenticate the user for or <code>null</code>
  79. * if this authentication is not for a CVS repository location.
  80. * @param destination The destination in the format like username@hostname:port
  81. * @param name A name about this dialog.
  82. * @param instruction A message for the instruction.
  83. * @param prompt Labels for text fields.
  84. * @param echo the array to show which fields are secret.
  85. * @return the entered values, or null if the user canceled.
  86. *
  87. * @since 3.0
  88. */
  89. public String[] promptForKeyboradInteractive(ICVSRepositoryLocation location, String destination, String name, String instruction, String[] prompt, boolean[] echo) throws CVSException;
  90. /**
  91. * Prompts the authenticator for additional information regarding this authentication
  92. * request. A default implementation of this method should return the <code>defaultResponse</code>,
  93. * whereas alternate implementations could prompt the user with a dialog.
  94. *
  95. * @param location the repository location for this authentication or <code>null</code>
  96. * if this authentication is not for a CVS repository location.
  97. * @param promptType one of the following values:
  98. * <ul>
  99. * <li> <code>NONE</code> for a unspecified prompt type </li>
  100. * <li> <code>ERROR</code> for an error prompt </li>
  101. * <li> <code>INFORMATION</code> for an information prompt </li>
  102. * <li> <code>QUESTION </code> for a question prompt </li>
  103. * <li> <code>WARNING</code> for a warning prompt </li>
  104. * </ul>
  105. * @param title the prompt title that could be displayed to the user
  106. * @param message the prompt
  107. * @param promptResponses the possible responses to the prompt
  108. * @param defaultResponse the default response to the prompt
  109. * @return the response to the prompt
  110. *
  111. * @since 3.0
  112. */
  113. public int prompt(ICVSRepositoryLocation location, int promptType, String title, String message, int[] promptResponses, int defaultResponseIndex);
  114. /**
  115. * The host key for the given location has changed.
  116. * @param location
  117. * @return true if new host key should be accepted
  118. */
  119. public boolean promptForHostKeyChange(ICVSRepositoryLocation location);
  120. /**
  121. * If the project set contains only partial repository information (some of
  122. * location are unknown) we will display a dialog to associate each project
  123. * set repository with a known repository location or create a new one or at
  124. * last use the default locations.
  125. *
  126. * @param alternativeMap
  127. * a map of CVS repository locations form the project set (as
  128. * keys) and a list of suggested alternative (known) CVS
  129. * repository locations (as values)
  130. * @return a map of CVS repository locations from the project set (as keys)
  131. * and confirmed CVS repository locations to be used during checkout
  132. * (as values) or <code>null</code> if the operation is to be
  133. * canceled
  134. */
  135. public abstract Map promptToConfigureRepositoryLocations(Map alternativeMap);
  136. }