public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item owner, @QueryParameter String collectionUrl) { StandardListBoxModel listBoxModel = new StandardListBoxModel(); listBoxModel.withEmptySelection(); String hostName = null; try { final URI uri = new URI(collectionUrl); hostName = uri.getHost(); } catch (final URISyntaxException ignored) { } listBoxModel.withAll(TeamCollectionConfiguration.findCredentials(hostName, owner)); return listBoxModel; }
public ListBoxModel doFillDockerRegistryCredentialsItems(@AncestorInPath Item item, @QueryParameter String uri) { return new StandardListBoxModel() .withEmptySelection() .withMatching(AuthenticationTokens.matcher(DockerRegistryToken.class), CredentialsProvider.lookupCredentials( StandardCredentials.class, item, null, Collections.<DomainRequirement>emptyList() ) ); }
public ListBoxModel doFillCredentialsIdItems() { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.always(), CredentialsProvider.lookupCredentials(AmazonWebServicesCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, Collections.emptyList())); } }
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 doFillCredentialsIdItems(@AncestorInPath ItemGroup context) { List<DockerRegistryAuthCredentials> credentials = CredentialsProvider.lookupCredentials(DockerRegistryAuthCredentials.class, context, ACL.SYSTEM, Collections.emptyList()); return new StandardListBoxModel().withEmptySelection() .withMatching(CredentialsMatchers.instanceOf(DockerRegistryAuthCredentials.class), credentials); } }
@SuppressWarnings("unused") public ListBoxModel doFillCredentialsIdItems( @QueryParameter final String collectionUrl) { final Jenkins jenkins = Jenkins.getInstance(); String hostName = null; try { final URI uri = new URI(collectionUrl); hostName = uri.getHost(); } catch (final URISyntaxException ignored) { } if (hostName == null || !jenkins.hasPermission(Jenkins.ADMINISTER)) { return new ListBoxModel(); } final List<StandardUsernamePasswordCredentials> matches = findCredentials(hostName); return new StandardListBoxModel() .withEmptySelection() .withAll(matches); } }
public ListBoxModel doFillCredentialsIdItems() { return new StandardListBoxModel() .withEmptySelection() .withMatching( instanceOf(UsernamePasswordCredentials.class), CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, (Item) null, ACL.SYSTEM, (DomainRequirement) null ) ); } }
public ListBoxModel doFillCredentialIdItems(@AncestorInPath Jenkins context) { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.anyOf( CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class) ), CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, context, ACL.SYSTEM, new ArrayList<DomainRequirement>()) ); }
@Restricted(DoNotUse.class) // Stapler only. @SuppressWarnings("unused") // Used by stapler. @RequirePOST public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String master) { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); List<DomainRequirement> domainRequirements = (master == null) ? Collections.<DomainRequirement>emptyList() : URIRequirementBuilder.fromUri(master.trim()).build(); return new StandardListBoxModel().withEmptySelection().withMatching( CredentialsMatchers.instanceOf(UsernamePasswordCredentials.class), CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, item, null, domainRequirements) ); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item) { return new StandardListBoxModel().withEmptySelection().withMatching( CredentialsMatchers.anyOf( CredentialsMatchers.instanceOf(StringCredentials.class), CredentialsMatchers.instanceOf(UsernamePasswordCredentials.class) ), CredentialsProvider.lookupCredentials(StandardCredentials.class, item, null, Collections.<DomainRequirement>emptyList()) ); }
/** * Populate the credentials dropdown box * @return A ListBoxModel containing all global credentials */ public ListBoxModel doFillCredentialsIdItems() { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.allOf(CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class)), CredentialsProvider.lookupCredentials(StandardCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, Collections.<DomainRequirement>emptyList()) ); } }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item project, @QueryParameter String serverAddress) { if (project == null || !project.hasPermission(Item.CONFIGURE)) { return new StandardListBoxModel(); } return new StandardListBoxModel() .withEmptySelection() .withMatching( DockerCommand.CREDENTIALS_MATCHER, CredentialsProvider.lookupCredentials(StandardCredentials.class, project, ACL.SYSTEM, URIRequirementBuilder.fromUri(serverAddress).build())); }
public static ListBoxModel fillPluginCredentials(Item project, Authentication authentication) { if (project != null && !project.hasPermission(Item.CONFIGURE)) { return new StandardListBoxModel(); } List<DomainRequirement> domainRequirements = Collections.emptyList(); return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.anyOf( CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class), CredentialsMatchers.instanceOf(StandardCertificateCredentials.class) ), CredentialsProvider.lookupCredentials(StandardCredentials.class, project, authentication, domainRequirements) ); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item) { if (item == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || item != null && !item.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } // TODO may also need to specify a specific authentication and domain requirements return new StandardListBoxModel() .withEmptySelection() .withMatching(AuthenticationTokens.matcher(DockerRegistryToken.class), CredentialsProvider.lookupCredentials( StandardCredentials.class, item, null, Collections.<DomainRequirement>emptyList() ) ); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String uri) { if (item == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || item != null && !item.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(uri).build(); domainRequirements.add(new DockerServerDomainRequirement()); return new StandardListBoxModel() .withEmptySelection() .withMatching( AuthenticationTokens.matcher(KeyMaterialFactory.class), CredentialsProvider .lookupCredentials(BASE_CREDENTIAL_TYPE, item, null, domainRequirements) ); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String uri) { if (item == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || item != null && !item.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(uri).build(); domainRequirements.add(new DockerServerDomainRequirement()); return new StandardListBoxModel() .withEmptySelection() .withMatching( AuthenticationTokens.matcher(KeyMaterialFactory.class), CredentialsProvider .lookupCredentials(BASE_CREDENTIAL_TYPE, item, null, domainRequirements) ); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item) { if (item == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || item != null && !item.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } // TODO may also need to specify a specific authentication and domain requirements return new StandardListBoxModel() .withEmptySelection() .withMatching(AuthenticationTokens.matcher(DockerRegistryToken.class), CredentialsProvider.lookupCredentials( StandardCredentials.class, item, null, Collections.<DomainRequirement>emptyList() ) ); }
public static ListBoxModel doFillCredentialsIdItems(String endpointUrl) { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(TokenCredentialsImpl.class), CredentialsMatchers.instanceOf(UsernamePasswordCredentials.class)), CredentialsProvider.lookupCredentials(StandardCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, URIRequirementBuilder.fromUri(endpointUrl).build())); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String serverUrl) { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.anyOf( CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class), CredentialsMatchers.instanceOf(TokenProducer.class), CredentialsMatchers.instanceOf(StandardCertificateCredentials.class), CredentialsMatchers.instanceOf(FileCredentials.class) ), CredentialsProvider.lookupCredentials( StandardCredentials.class, item, null, URIRequirementBuilder.fromUri(serverUrl).build() ) ); }
public ListBoxModel doFillCredentialsIdItems(@QueryParameter String serverUrl) { return new StandardListBoxModel().withEmptySelection() // .withMatching( // CredentialsMatchers.anyOf( CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class), CredentialsMatchers.instanceOf(FileCredentials.class), CredentialsMatchers.instanceOf(TokenProducer.class), CredentialsMatchers.instanceOf( org.jenkinsci.plugins.kubernetes.credentials.TokenProducer.class), CredentialsMatchers.instanceOf(StandardCertificateCredentials.class), CredentialsMatchers.instanceOf(StringCredentials.class)), // CredentialsProvider.lookupCredentials(StandardCredentials.class, // Jenkins.getInstance(), // ACL.SYSTEM, // serverUrl != null ? URIRequirementBuilder.fromUri(serverUrl).build() : Collections.EMPTY_LIST // )); }