public ListBoxModel doFillApiTokenIdItems(@QueryParameter String name, @QueryParameter String url) { if (Jenkins.getInstance().hasPermission(Item.CONFIGURE)) { AbstractIdCredentialsListBoxModel<StandardListBoxModel, StandardCredentials> options = new StandardListBoxModel() .includeEmptyValue() .includeMatchingAs(ACL.SYSTEM, Jenkins.getActiveInstance(), StandardCredentials.class, URIRequirementBuilder.fromUri(url).build(), new GitLabCredentialMatcher()); if (name != null && connectionMap.containsKey(name)) { String apiTokenId = connectionMap.get(name).getApiTokenId(); options.includeCurrentValue(apiTokenId); for (ListBoxModel.Option option : options) { if (option.value.equals(apiTokenId)) { option.selected = true; } } } return options; } return new StandardListBoxModel(); }
/** * {@inheritDoc} */ @Override public final boolean equals(Object o) { return IdCredentials.Helpers.equals(this, o); }
/** * Returns the {@link IdCredentials#getId()} of the {@link #credentials}. * * @return the {@link IdCredentials#getId()} of the {@link #credentials}. */ public String getId() { return credentials instanceof IdCredentials ? ((IdCredentials) credentials).getId() : null; }
public static ListBoxModel doFillCredentialsIdItems(ItemGroup context) { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.always(), CredentialsProvider.lookupCredentials(AmazonWebServicesCredentials.class, context, ACL.SYSTEM, Collections.EMPTY_LIST)); } }
public ListBoxModel doFillGlobalCredentialsIdItems() { Job owner = null; List<DomainRequirement> apiEndpoint = URIRequirementBuilder.fromUri(BitbucketApi.OAUTH_ENDPOINT).build(); return new StandardUsernameListBoxModel() .withEmptySelection() .withAll(CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, owner, null, apiEndpoint)); }
/** * {@inheritDoc} */ @NonNull @Override public String getName(@NonNull UsernamePasswordCredentials credentials) { return credentials.getUsername() + "/******"; } }
@Override public String getKeyName() { return credential.getId(); }
/** * Returns the username to authenticate as. * * @return the username to authenticate as. * @since 1.4 */ public String getUsername() { return username == null ? getUser().getUsername() : username; }
/** * {@inheritDoc} */ @NonNull @Override public String getName(@NonNull StandardCertificateCredentials c) { String description = Util.fixEmptyAndTrim(c.getDescription()); String subjectDN = getSubjectDN(c.getKeyStore()); return (subjectDN == null ? c.getDescriptor().getDisplayName() : subjectDN) + (description != null ? " (" + description + ")" : ""); } }
public SVNUsernameAuthenticationBuilder(UsernameCredentials c) { this.username = c.getUsername(); }
/** * {@inheritDoc} */ @Override public final int hashCode() { return IdCredentials.Helpers.hashCode(this); }
/** * Gets the description of the {@link Credentials}. * * @return the description of the {@link Credentials}. */ @Exported public String getDescription() { return credentials instanceof StandardCredentials ? ((StandardCredentials) credentials).getDescription() : null; }
public ListBoxModel doFillCredentialsIdItems() { return new StandardListBoxModel() .withEmptySelection() .withMatching( instanceOf(UsernamePasswordCredentials.class), CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, (Item) null, ACL.SYSTEM, (DomainRequirement) null ) ); } }
/** * {@inheritDoc} */ @NonNull @Override public String getName(@NonNull UsernameCredentials credentials) { return credentials.getUsername(); } }
/** * Returns the {@link IdCredentials#getId()} of the {@link #credentials}. * * @return the {@link IdCredentials#getId()} of the {@link #credentials}. */ public String getId() { return credentials instanceof IdCredentials ? ((IdCredentials) credentials).getId() : null; }
/** * {@inheritDoc} */ @Override public final boolean equals(Object o) { return IdCredentials.Helpers.equals(this, o); }
/** * {@inheritDoc} */ @Override public final int hashCode() { return IdCredentials.Helpers.hashCode(this); }
/** * The standard {@link #hashCode()} implementation. * * @param self the {@code this} reference. * @return the hash code. */ public static int hashCode(IdCredentials self) { return self.getId().hashCode(); }