Tabnine Logo
SSHAuthenticator.matcher
Code IndexAdd Tabnine to your IDE (free)

How to use
matcher
method
in
com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator

Best Java code snippets using com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.matcher (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: org.jenkins-ci.plugins/ssh-credentials

/**
 * Adds a collection of credentials (they will be filtered with {@link SSHAuthenticator#matcher()} implicitly).
 *
 * @param col the collection of credentials.
 * @return {@code this} for method chaining.
 * @deprecated use {@link #withMatching(CredentialsMatcher, Iterable)} or {@link #withAll(Iterable)}
 */
@Deprecated
public SSHUserListBoxModel addCollection(Collection<? extends StandardUsernameCredentials> col) {
  withMatching(SSHAuthenticator.matcher(), col);
  return this;
}
origin: org.jenkins-ci.plugins/ssh-credentials

/**
 * Adds all the system-scoped credentials (they will be filtered with {@link SSHAuthenticator#matcher()}
 * implicitly).
 * <p>
 * These credentials are meant to be used for system configuration and other things scoped to the {@link Jenkins}
 * object,
 * such as slaves.
 * </p>
 *
 * @param domainRequirements the domain requirements
 * @return {@code this} for method chaining.
 */
public SSHUserListBoxModel withSystemScopeCredentials(DomainRequirement... domainRequirements) {
  return withSystemScopeCredentials(SSHAuthenticator.matcher(), domainRequirements);
}
origin: org.jenkins-ci.plugins/ssh-credentials

/**
 * Adds all the system-scoped credentials (they will be filtered with {@link SSHAuthenticator#matcher()}
 * implicitly).
 * <p>
 * These credentials are meant to be used for system configuration and other things scoped to the {@link Jenkins}
 * object,
 * such as slaves.
 * </p>
 *
 * @param domainRequirements the domain requirements
 * @return {@code this} for method chaining.
 */
public SSHUserListBoxModel withSystemScopeCredentials(List<DomainRequirement> domainRequirements) {
  return withSystemScopeCredentials(SSHAuthenticator.matcher(), domainRequirements);
}
origin: org.jenkins-ci.plugins/ssh-credentials

/**
 * Filters {@link Credentials} returning only those which are supported with the specified type of connection.
 *
 * @param credentials     the credentials to filter.
 * @param connectionClass the type of connection to filter for.
 * @return a list of {@link SSHUser} credentials appropriate for use with the supplied type of connection.
 * @deprecated Use
 * {@link CredentialsMatchers#filter(List, CredentialsMatcher)}
 * and {@link #matcher(Class)}
 */
public static List<? extends StandardUsernameCredentials> filter(Iterable<? extends Credentials> credentials,
                                 Class<?> connectionClass) {
  List<StandardUsernameCredentials> result = new ArrayList<StandardUsernameCredentials>();
  CredentialsMatcher matcher = matcher(connectionClass);
  for (Credentials credential : credentials) {
    if (credential instanceof StandardUsernameCredentials && matcher.matches(credential)) {
      result.add((StandardUsernameCredentials) credential);
    }
  }
  return result;
}
origin: org.jenkins-ci.plugins/ssh-slaves

public FormValidation doCheckCredentialsId(@AncestorInPath ItemGroup context,
                      @QueryParameter String value) {
  AccessControlled _context =
      (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
    return FormValidation.ok(); // no need to alarm a user that cannot configure
  }
  for (ListBoxModel.Option o : CredentialsProvider.listCredentials(StandardUsernameCredentials.class, context, ACL.SYSTEM,
      Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME),
      SSHAuthenticator.matcher(Connection.class))) {
    if (StringUtils.equals(value, o.value)) {
      return FormValidation.ok();
    }
  }
  return FormValidation.error(Messages.SSHLauncher_SelectedCredentialsMissing());
}
origin: jenkinsci/ssh-slaves-plugin

public FormValidation doCheckCredentialsId(@AncestorInPath ItemGroup context,
                      @QueryParameter String value) {
  AccessControlled _context =
      (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
    return FormValidation.ok(); // no need to alarm a user that cannot configure
  }
  for (ListBoxModel.Option o : CredentialsProvider.listCredentials(StandardUsernameCredentials.class, context, ACL.SYSTEM,
      Collections.singletonList(SSHLauncher.SSH_SCHEME),
      SSHAuthenticator.matcher(Connection.class))) {
    if (StringUtils.equals(value, o.value)) {
      return FormValidation.ok();
    }
  }
  return FormValidation.error(Messages.SSHLauncher_SelectedCredentialsMissing());
}
origin: org.jenkins-ci.plugins/ssh-slaves

public FormValidation doCheckCredentialsId(@AncestorInPath ItemGroup context,
                      @QueryParameter String host,
                      @QueryParameter String port,
                      @QueryParameter String value) {
  AccessControlled _context =
      (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
    return FormValidation.ok(); // no need to alarm a user that cannot configure
  }
  try {
    int portValue = Integer.parseInt(port);
    for (ListBoxModel.Option o : CredentialsProvider
        .listCredentials(StandardUsernameCredentials.class, context, ACL.SYSTEM,
            Collections.<DomainRequirement>singletonList(
                new HostnamePortRequirement(host, portValue)
            ),
            SSHAuthenticator.matcher(Connection.class))) {
      if (StringUtils.equals(value, o.value)) {
        return FormValidation.ok();
      }
    }
  } catch (NumberFormatException e) {
    return FormValidation.warning(e, Messages.SSHLauncher_PortNotANumber());
  }
  return FormValidation.error(Messages.SSHLauncher_SelectedCredentialsMissing());
}
origin: jenkinsci/ssh-slaves-plugin

public FormValidation doCheckCredentialsId(@AncestorInPath ItemGroup context,
                      @AncestorInPath AccessControlled _context,
                      @QueryParameter String host,
                      @QueryParameter String port,
                      @QueryParameter String value) {
  Jenkins jenkins = Jenkins.getInstance();
  if ((_context == jenkins && !jenkins.hasPermission(Computer.CREATE)) || (_context != jenkins && !_context.hasPermission(Computer.CONFIGURE))) {
    return FormValidation.ok(); // no need to alarm a user that cannot configure
  }
  try {
    int portValue = Integer.parseInt(port);
    for (ListBoxModel.Option o : CredentialsProvider
        .listCredentials(StandardUsernameCredentials.class, context, ACL.SYSTEM,
            Collections.singletonList(
                new HostnamePortRequirement(host, portValue)
            ),
            SSHAuthenticator.matcher(Connection.class))) {
      if (StringUtils.equals(value, o.value)) {
        return FormValidation.ok();
      }
    }
  } catch (NumberFormatException e) {
    return FormValidation.warning(e, Messages.SSHLauncher_PortNotANumber());
  }
  return FormValidation.error(Messages.SSHLauncher_SelectedCredentialsMissing());
}
origin: jenkinsci/jclouds-plugin

public ListBoxModel doFillAdminCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String currentValue) {
  if (!(context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()).hasPermission(Computer.CONFIGURE)) {
    return new StandardUsernameListBoxModel().includeCurrentValue(currentValue);
  }
  return new StandardUsernameListBoxModel().includeMatchingAs(
      ACL.SYSTEM, context, StandardUsernameCredentials.class,
      Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME),
      SSHAuthenticator.matcher(Connection.class)).includeCurrentValue(currentValue);
}
origin: jenkinsci/jclouds-plugin

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String currentValue) {
  if (!(context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()).hasPermission(Computer.CONFIGURE)) {
    return new StandardUsernameListBoxModel().includeCurrentValue(currentValue);
  }
  return new StandardUsernameListBoxModel().includeMatchingAs(
      ACL.SYSTEM, context, StandardUsernameCredentials.class,
      Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME),
      SSHAuthenticator.matcher(Connection.class)).includeCurrentValue(currentValue);
}
origin: jenkinsci/ssh-slaves-plugin

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String credentialsId) {
  AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
    return new StandardUsernameListBoxModel()
        .includeCurrentValue(credentialsId);
  }
  return new StandardUsernameListBoxModel()
      .includeMatchingAs(
          ACL.SYSTEM,
          context,
          StandardUsernameCredentials.class,
          Collections.singletonList(SSHLauncher.SSH_SCHEME),
          SSHAuthenticator.matcher(Connection.class)
      )
      .includeCurrentValue(credentialsId);
}
origin: jenkinsci/ssh-plugin

public ListBoxModel doFillCredentialIdItems(final @AncestorInPath ItemGroup<?> context) {
  final List<StandardUsernameCredentials> credentials = CredentialsProvider.lookupCredentials(
      StandardUsernameCredentials.class, context, ACL.SYSTEM, CredentialsSSHSite.NO_REQUIREMENTS);
  return new SSHUserListBoxModel().withEmptySelection().withMatching(
      SSHAuthenticator.matcher(JSchConnector.class), credentials);
}
origin: org.jenkins-ci.plugins/ssh-slaves

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String credentialsId) {
  AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
    return new StandardUsernameListBoxModel()
        .includeCurrentValue(credentialsId);
  }
  return new StandardUsernameListBoxModel()
      .includeMatchingAs(
          ACL.SYSTEM,
          context,
          StandardUsernameCredentials.class,
          Collections.<DomainRequirement>singletonList(SSHLauncher.SSH_SCHEME),
          SSHAuthenticator.matcher(Connection.class)
      )
      .includeCurrentValue(credentialsId);
}
origin: org.jenkins-ci.plugins/ssh-slaves

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context,
                       @QueryParameter String host,
                       @QueryParameter String port,
                       @QueryParameter String credentialsId) {
  AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
    return new StandardUsernameListBoxModel()
        .includeCurrentValue(credentialsId);
  }
  try {
    int portValue = Integer.parseInt(port);
    return new StandardUsernameListBoxModel()
        .includeMatchingAs(
            ACL.SYSTEM,
            Jenkins.getActiveInstance(),
            StandardUsernameCredentials.class,
            Collections.<DomainRequirement>singletonList(
                new HostnamePortRequirement(host, portValue)
            ),
            SSHAuthenticator.matcher(Connection.class))
        .includeCurrentValue(credentialsId); // always add the current value last in case already present
  } catch (NumberFormatException ex) {
    return new StandardUsernameListBoxModel()
        .includeCurrentValue(credentialsId);
  }
}
origin: jenkinsci/ssh-slaves-plugin

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath AccessControlled context,
                       @QueryParameter String host,
                       @QueryParameter String port,
                       @QueryParameter String credentialsId) {
  Jenkins jenkins = Jenkins.getInstance();
  if ((context == jenkins && !jenkins.hasPermission(Computer.CREATE)) || (context != jenkins && !context.hasPermission(Computer.CONFIGURE))) {
    return new StandardUsernameListBoxModel()
        .includeCurrentValue(credentialsId);
  }
  try {
    int portValue = Integer.parseInt(port);
    return new StandardUsernameListBoxModel()
        .includeMatchingAs(
            ACL.SYSTEM,
            jenkins,
            StandardUsernameCredentials.class,
            Collections.singletonList(
                new HostnamePortRequirement(host, portValue)
            ),
            SSHAuthenticator.matcher(Connection.class))
        .includeCurrentValue(credentialsId); // always add the current value last in case already present
  } catch (NumberFormatException ex) {
    return new StandardUsernameListBoxModel()
        .includeCurrentValue(credentialsId);
  }
}
origin: jenkinsci/docker-plugin

  public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
    if (!ac.hasPermission(Jenkins.ADMINISTER)) {
      return new ListBoxModel();
    }
    return new SSHUserListBoxModel().withMatching(SSHAuthenticator.matcher(Connection.class),
        CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, context,
            ACL.SYSTEM, SSHLauncher.SSH_SCHEME));
  }
}
origin: KostyaSha/yet-another-docker-plugin

public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
  AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (!ac.hasPermission(Jenkins.ADMINISTER)) {
    return new ListBoxModel();
  }
  return new SSHUserListBoxModel().withMatching(
      SSHAuthenticator.matcher(Connection.class),
      CredentialsProvider.lookupCredentials(
          StandardUsernameCredentials.class,
          context,
          ACL.SYSTEM,
          SSHLauncher.SSH_SCHEME)
  );
}
origin: jenkinsci/docker-plugin

public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
  AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
  if (!ac.hasPermission(Jenkins.ADMINISTER)) {
    return new ListBoxModel();
  }
  return new SSHUserListBoxModel().withMatching(
      SSHAuthenticator.matcher(Connection.class),
      CredentialsProvider.lookupCredentials(
          StandardUsernameCredentials.class,
          context,
          ACL.SYSTEM,
          SSHLauncher.SSH_SCHEME)
  );
}
origin: jenkinsci/openstack-cloud-plugin

  @Restricted(DoNotUse.class)
  @RequirePOST
  public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    if (!(context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getActiveInstance()).hasPermission(Computer.CONFIGURE)) {
      return new ListBoxModel();
    }
    List<StandardUsernameCredentials> credentials = CredentialsProvider.lookupCredentials(
        StandardUsernameCredentials.class, context, ACL.SYSTEM, SSHLauncher.SSH_SCHEME
    );
    return new StandardUsernameListBoxModel()
        .withMatching(SSHAuthenticator.matcher(Connection.class), credentials)
        .withEmptySelection()
    ;
  }
}
com.cloudbees.jenkins.plugins.sshcredentialsSSHAuthenticatormatcher

Javadoc

Returns a CredentialsMatcher that matches the generic types of credential that are valid for use over SSH. When you know the connection type you will be using, it is better to use #matcher(Class).

Popular methods of SSHAuthenticator

  • authenticate
    Authenticate the bound connection using the supplied credentials.
  • newInstance
    Creates an authenticator that may be able to authenticate the supplied connection with the supplied
  • canAuthenticate
    Returns true if the bound connection is in a state where authentication can be tried using the suppl
  • doAuthenticate
    SPI for authenticating the bound connection using the supplied credentials. As a guideline, authenti
  • getAuthenticationMode
    Returns the mode of authentication that this SSHAuthenticator supports.
  • getUser
    Gets the supplied credentials.
  • isAuthenticated
    Returns true if the bound connection has been authenticated.
  • isSupported
    Returns true if and only if the supplied connection class and user class are supported by at least o
  • lookupFactories
    This method allows a build agent to invoke #newInstance(Object,StandardUsernameCredentials,String)af
  • setListener
    Sets the TaskListener that receives errors that happen during the authentication. If you are doing t

Popular in Java

  • Updating database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now