private static StandardCredentials lookupCredentials( Item project, @Nonnull String credentialId, String uri) { return CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials( StandardCredentials.class, project, ACL.SYSTEM, GitURIRequirementsBuilder.fromUri(uri).build()), CredentialsMatchers.withId(credentialId)); }
public ListBoxModel doFillCredentialsIdItems( @AncestorInPath Item project, @QueryParameter String url) { if (project == null || !project.hasPermission(Item.CONFIGURE)) { return new StandardListBoxModel(); } return new StandardListBoxModel() .withEmptySelection() .withMatching( GitClient.CREDENTIALS_MATCHER, CredentialsProvider.lookupCredentials( StandardCredentials.class, project, ACL.SYSTEM, GitURIRequirementsBuilder.fromUri(url).build())); }