? Tasks.getAuthenticationOf((Queue.Task) project) : ACL.SYSTEM, GitURIRequirementsBuilder.fromUri(url).build(), GitClient.CREDENTIALS_MATCHER)) { if (StringUtils.equals(value, o.value)) {
private static StandardCredentials lookupCredentials(@CheckForNull Item project, String credentialId, String uri) { return (credentialId == null) ? null : 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, @QueryParameter String credentialsId) { if (project == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || project != null && !project.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel().includeCurrentValue(credentialsId); } if (project == null) { /* Construct a fake project */ project = new FreeStyleProject(Jenkins.getInstance(), "fake-" + UUID.randomUUID().toString()); } return new StandardListBoxModel() .includeEmptyValue() .includeMatchingAs( project instanceof Queue.Task ? Tasks.getAuthenticationOf((Queue.Task) project) : ACL.SYSTEM, project, StandardUsernameCredentials.class, GitURIRequirementsBuilder.fromUri(url).build(), GitClient.CREDENTIALS_MATCHER) .includeCurrentValue(credentialsId); }