Tabnine Logo
CredentialsStore.getCredentials
Code IndexAdd Tabnine to your IDE (free)

How to use
getCredentials
method
in
com.cloudbees.plugins.credentials.CredentialsStore

Best Java code snippets using com.cloudbees.plugins.credentials.CredentialsStore.getCredentials (Showing top 14 results out of 315)

origin: org.jenkins-ci.plugins/credentials

protected static Credentials getCredentialsById(CredentialsStore store, Domain domain, String id) {
  List<Credentials> credentialsList = store.getCredentials(domain);
  Set<String> ids = new HashSet<String>(credentialsList.size());
  Credentials existing = null;
  int index = 0;
  for (Credentials c : credentialsList) {
    String cid;
    if (c instanceof IdCredentials) {
      cid = ((IdCredentials) c).getId();
    } else {
      while (ids.contains("index-" + index)) {
        index++;
      }
      cid = "index-" + index;
      index++;
    }
    if (id.equals(cid)) {
      existing = c;
      break;
    }
    ids.add(cid);
  }
  return existing;
}
origin: jenkinsci/credentials-plugin

protected static Credentials getCredentialsById(CredentialsStore store, Domain domain, String id) {
  List<Credentials> credentialsList = store.getCredentials(domain);
  Set<String> ids = new HashSet<String>(credentialsList.size());
  Credentials existing = null;
  int index = 0;
  for (Credentials c : credentialsList) {
    String cid;
    if (c instanceof IdCredentials) {
      cid = ((IdCredentials) c).getId();
    } else {
      while (ids.contains("index-" + index)) {
        index++;
      }
      cid = "index-" + index;
      index++;
    }
    if (id.equals(cid)) {
      existing = c;
      break;
    }
    ids.add(cid);
  }
  return existing;
}
origin: jenkinsci/credentials-plugin

@Override
protected int run() throws Exception {
  store.checkPermission(CredentialsProvider.UPDATE);
  List<DomainCredentials> existing = new ArrayList<>();
  List<Domain> domains = store.getDomains();
  for (Domain domain : domains) {
    existing.add(new DomainCredentials(domain, store.getCredentials(domain)));
  }
  CredentialsStoreAction.SECRETS_REDACTED.toXML(existing, new OutputStreamWriter(stdout, "UTF-8"));
  return 0;
}
origin: org.jenkins-ci.plugins/credentials

/**
 * Exposes a map of the wrapped credentials.
 *
 * @return a map of the wrapped credentials.
 */
@NonNull
public Map<String, CredentialsWrapper> getCredentials() {
  Map<String, CredentialsWrapper> result = new LinkedHashMap<String, CredentialsWrapper>();
  int index = 0;
  for (Credentials c : getStore().getCredentials(domain)) {
    String id;
    if (c instanceof IdCredentials) {
      id = ((IdCredentials) c).getId();
    } else {
      while (result.containsKey("index-" + index)) {
        index++;
      }
      id = "index-" + index;
      index++;
    }
    result.put(id, new CredentialsWrapper(this, c, id));
  }
  return result;
}
origin: org.jenkins-ci.plugins/credentials

List<Domain> domains = store.getDomains();
for (Domain domain : domains) {
  List<Credentials> credentials = store.getCredentials(domain);
  Map<String, String> nameById = new LinkedHashMap<String, String>(credentials.size());
  int maxIdLen = "# of Credentials".length(), maxNameLen = 0;
origin: jenkinsci/credentials-plugin

/**
 * Exposes a map of the wrapped credentials.
 *
 * @return a map of the wrapped credentials.
 */
@NonNull
public Map<String, CredentialsWrapper> getCredentials() {
  Map<String, CredentialsWrapper> result = new LinkedHashMap<String, CredentialsWrapper>();
  int index = 0;
  for (Credentials c : getStore().getCredentials(domain)) {
    String id;
    if (c instanceof IdCredentials) {
      id = ((IdCredentials) c).getId();
    } else {
      while (result.containsKey("index-" + index)) {
        index++;
      }
      id = "index-" + index;
      index++;
    }
    result.put(id, new CredentialsWrapper(this, c, id));
  }
  return result;
}
origin: org.jenkins-ci.plugins/credentials

private String url(CredentialsStore store) {
  for (Domain d: store.getDomains()) {
    for (Credentials c: store.getCredentials(d)) {
      if (c instanceof IdCredentials && value.equals(((IdCredentials) c).getId())) {
        String link = store.getRelativeLinkToAction();
        return link == null ? null : link + d.getUrl() + "credential/"+ Util.rawEncode(value);
      }
    }
  }
  return null;
}
origin: jenkinsci/credentials-plugin

List<Domain> domains = store.getDomains();
for (Domain domain : domains) {
  List<Credentials> credentials = store.getCredentials(domain);
  Map<String, String> nameById = new LinkedHashMap<String, String>(credentials.size());
  int maxIdLen = "# of Credentials".length(), maxNameLen = 0;
origin: jenkinsci/credentials-plugin

private String url(CredentialsStore store) {
  for (Domain d: store.getDomains()) {
    for (Credentials c: store.getCredentials(d)) {
      if (c instanceof IdCredentials && value.equals(((IdCredentials) c).getId())) {
        String link = store.getRelativeLinkToAction();
        return link == null ? null : link + d.getUrl() + "credential/"+ Util.rawEncode(value);
      }
    }
  }
  return null;
}
origin: org.jenkins-ci.plugins/credentials

if (p.hasPermission(CredentialsProvider.VIEW)) {
  for (Domain domain : p.getDomains()) {
    for (Credentials c : p.getCredentials(domain)) {
      CredentialsScope scope = c.getScope();
      if (scope != null && !scope.isVisible(context)) {
origin: jenkinsci/credentials-plugin

if (p.hasPermission(CredentialsProvider.VIEW)) {
  for (Domain domain : p.getDomains()) {
    for (Credentials c : p.getCredentials(domain)) {
      CredentialsScope scope = c.getScope();
      if (scope != null && !scope.isVisible(context)) {
origin: jenkinsci/marathon-plugin

for (Credentials c : credentialsStore.getCredentials(d)) {
  if (!(c instanceof StringCredentials)) continue;
origin: org.jenkins-ci.plugins/credentials

@CheckForNull
private static FormValidation checkForDuplicates(String value, ModelObject context, ModelObject object) {
  CredentialsMatcher withId = CredentialsMatchers.withId(value);
  for (CredentialsStore store : CredentialsProvider.lookupStores(object)) {
    if (!store.hasPermission(CredentialsProvider.VIEW)) {
      continue;
    }
    ModelObject storeContext = store.getContext();
    for (Domain domain : store.getDomains()) {
      for (Credentials match : CredentialsMatchers.filter(store.getCredentials(domain), withId)) {
        if (storeContext == context) {
          return FormValidation.error("This ID is already in use");
        } else {
          CredentialsScope scope = match.getScope();
          if (scope != null && !scope.isVisible(context)) {
            // scope is not exported to child contexts
            continue;
          }
          return FormValidation.warning("The ID ‘%s’ is already in use in %s", value,
              storeContext instanceof Item
                  ? ((Item) storeContext).getFullDisplayName()
                  : storeContext.getDisplayName());
        }
      }
    }
  }
  return null;
}
origin: jenkinsci/credentials-plugin

@CheckForNull
private static FormValidation checkForDuplicates(String value, ModelObject context, ModelObject object) {
  CredentialsMatcher withId = CredentialsMatchers.withId(value);
  for (CredentialsStore store : CredentialsProvider.lookupStores(object)) {
    if (!store.hasPermission(CredentialsProvider.VIEW)) {
      continue;
    }
    ModelObject storeContext = store.getContext();
    for (Domain domain : store.getDomains()) {
      for (Credentials match : CredentialsMatchers.filter(store.getCredentials(domain), withId)) {
        if (storeContext == context) {
          return FormValidation.error("This ID is already in use");
        } else {
          CredentialsScope scope = match.getScope();
          if (scope != null && !scope.isVisible(context)) {
            // scope is not exported to child contexts
            continue;
          }
          return FormValidation.warning("The ID ‘%s’ is already in use in %s", value,
              storeContext instanceof Item
                  ? ((Item) storeContext).getFullDisplayName()
                  : storeContext.getDisplayName());
        }
      }
    }
  }
  return null;
}
com.cloudbees.plugins.credentialsCredentialsStoregetCredentials

Javadoc

Returns an unmodifiable list of credentials for the specified domain.

Popular methods of CredentialsStore

  • addCredentials
    Adds the specified Credentials within the specified Domain for this CredentialsStore.
  • getDomains
    Returns all the com.cloudbees.plugins.credentials.domains.Domains that this credential provider has.
  • addDomain
    Adds a new Domain with seed credentials.
  • getContext
    Returns the context within which this store operates. Credentials in this store will be available to
  • getProvider
    Returns the CredentialsProvider.
  • isDomainsModifiable
    Identifies whether this CredentialsStore supports making changes to the list of domains or whether i
  • updateCredentials
    Updates the specified Credentials from the specified Domain for this CredentialsStore with the suppl
  • _isApplicable
    CredentialsStore subtypes can override this method to veto some Descriptors from being available fro
  • checkPermission
    Checks if the current security principal has this permission. Note: This is just a convenience funct
  • getACL
  • getContextDisplayName
    Returns the display name of the #getContext() of this CredentialsStore. The default implementation c
  • getCredentialsDescriptors
    Returns the list of CredentialsDescriptor instances that are applicable within this CredentialsStore
  • getContextDisplayName,
  • getCredentialsDescriptors,
  • getRelativeLinkToAction,
  • getRelativeLinkToContext,
  • getScopes,
  • getStoreAction,
  • hasPermission,
  • isOverridden,
  • removeCredentials

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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