当前位置: 首页>>代码示例>>Java>>正文


Java DomainRequirement类代码示例

本文整理汇总了Java中com.cloudbees.plugins.credentials.domains.DomainRequirement的典型用法代码示例。如果您正苦于以下问题:Java DomainRequirement类的具体用法?Java DomainRequirement怎么用?Java DomainRequirement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DomainRequirement类属于com.cloudbees.plugins.credentials.domains包,在下文中一共展示了DomainRequirement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCredentials

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Get the {@link StandardCredentials}.
 *
 * @return the credentials matching the {@link #credentialsId} or {@code null} is {@code #credentialsId} is blank
 * @throws AbortException if no {@link StandardCredentials} matching {@link #credentialsId} is found
 */
private StandardCredentials getCredentials(Run<?, ?> build) throws AbortException {
    if (StringUtils.isBlank(credentialsId)) {
        return null;
    }
    StandardCredentials result = CredentialsProvider.findCredentialById(
            credentialsId,
            StandardCredentials.class,
            build,
            Collections.<DomainRequirement>emptyList());

    if (result == null) {
        throw new AbortException("No credentials found for id \"" + credentialsId + "\"");
    }
    return result;
}
 
开发者ID:maxlaverse,项目名称:kubernetes-cli-plugin,代码行数:22,代码来源:KubeConfigWriter.java

示例2: doFillPrincipalCredentialIdItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
public ListBoxModel doFillPrincipalCredentialIdItems(
        @AncestorInPath Item item,
        @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.includeCurrentValue(credentialsId);
        }
    }
    List<AzureCredentials> creds = CredentialsProvider.lookupCredentials(AzureCredentials.class, item, ACL.SYSTEM, Collections.<DomainRequirement>emptyList());
    for (AzureCredentials cred
            :
            creds) {
        result.add(cred.getId());
    }
    return result.includeEmptyValue()
            .includeCurrentValue(credentialsId);
}
 
开发者ID:jenkinsci,项目名称:azure-cli-plugin,代码行数:24,代码来源:AzureCLIBuilder.java

示例3: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable connections.
 * 
 * @param context
 *            filter for login credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return login credentials selection
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId,
		@AncestorInPath Item project)
{
	List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
			Collections.<DomainRequirement> emptyList());

	ListBoxModel model = new ListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (StandardUsernamePasswordCredentials c : creds)
	{
		boolean isSelected = false;
		if (credentialsId != null)
		{
			isSelected = credentialsId.matches(c.getId());
		}

		String description = Util.fixEmptyAndTrim(c.getDescription());
		model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:Compuware-Corp,项目名称:CPWR-CodeCoverage,代码行数:38,代码来源:CodeCoverageBuilder.java

示例4: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable Jenkins credentials.
 * 
 * @param context
 *            filter for credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return credential selections
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId, @AncestorInPath Item project)
{
	List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
			Collections.<DomainRequirement> emptyList());

	StandardListBoxModel model = new StandardListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (StandardUsernamePasswordCredentials c : creds)
	{
		boolean isSelected = false;
		if (credentialsId != null)
		{
			isSelected = credentialsId.matches(c.getId());
		}

		String description = Util.fixEmptyAndTrim(c.getDescription());
		model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:37,代码来源:PdsConfiguration.java

示例5: getLoginInformation

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Retrieves login information given a credential ID.
 * 
 * @param project
 *            the Jenkins project
 *
 * @return a Jenkins credential with login information
 */
protected StandardUsernamePasswordCredentials getLoginInformation(Item project)
{
	StandardUsernamePasswordCredentials credential = null;

	List<StandardUsernamePasswordCredentials> credentials = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM, Collections.<DomainRequirement> emptyList());

	IdMatcher matcher = new IdMatcher(getCredentialsId());
	for (StandardUsernamePasswordCredentials c : credentials)
	{
		if (matcher.matches(c))
		{
			credential = c;
		}
	}

	return credential;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:27,代码来源:CpwrScmConfiguration.java

示例6: getLoginInformation

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Retrieves login information given a credential ID
 * 
 * @param project
 *            the Jenkins project
 *
 * @return a Jenkins credential with login information
 */
protected StandardUsernamePasswordCredentials getLoginInformation(Item project)
{
	StandardUsernamePasswordCredentials credential = null;

	List<StandardUsernamePasswordCredentials> credentials = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM, Collections.<DomainRequirement> emptyList());

	IdMatcher matcher = new IdMatcher(getCredentialsId());
	for (StandardUsernamePasswordCredentials c : credentials)
	{
		if (matcher.matches(c))
		{
			credential = c;
		}
	}

	return credential;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:27,代码来源:IspwConfiguration.java

示例7: getCurrentToken

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
public static String getCurrentToken() {
    String credentialsId = GlobalPluginConfiguration.get()
            .getCredentialsId();
    if (credentialsId.equals("")) {
        return "";
    }

    OpenShiftToken token = CredentialsMatchers.firstOrNull(
            CredentialsProvider.lookupCredentials(OpenShiftToken.class,
                    Jenkins.getActiveInstance(), ACL.SYSTEM,
                    Collections.<DomainRequirement> emptyList()),
            CredentialsMatchers.withId(credentialsId));

    if (token != null) {
        return token.getToken();
    }

    return "";
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:20,代码来源:CredentialsUtils.java

示例8: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.add(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.add(credentialsId);
        }
    }

    return result
            .withEmptySelection()
            .withAll(CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, item, null, Collections.<DomainRequirement>emptyList()))
            .withMatching(CredentialsMatchers.withId(credentialsId));
}
 
开发者ID:jenkinsci,项目名称:checkmarx-plugin,代码行数:19,代码来源:CxScanBuilder.java

示例9: doFillCredentialsIDItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIDItems(@AncestorInPath Jenkins context) {
    if (context == null || !context.hasPermission(Item.CONFIGURE)) {
        return new StandardListBoxModel();
    }

    List<DomainRequirement> domainRequirements = new ArrayList<DomainRequirement>();
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                            CredentialsMatchers.instanceOf(ConduitCredentials.class)),
                    CredentialsProvider.lookupCredentials(
                            StandardCredentials.class,
                            context,
                            ACL.SYSTEM,
                            domainRequirements));
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:18,代码来源:ConduitCredentialsDescriptor.java

示例10: FigShareNotifier

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Constructor called from a Jelly view. The parameters are given by a user.
 *
 * @param credentialsId figshare credential ID, selected out of a combo box
 * @param articleTitle figshare article title
 * @param articleDescription figshare article description
 * @param antPattern an ant-like pattern (e.g. **\/*.png)
 */
@DataBoundConstructor
public FigShareNotifier(String credentialsId, String articleTitle, String articleDescription, String antPattern) {
    this.credentialsId = credentialsId;
    this.articleTitle = articleTitle;
    this.articleDescription = articleDescription;
    this.antPattern = antPattern;

    // Get credential defined by user, using credential ID
    List<FigShareOauthCredentials> credentials = CredentialsProvider.lookupCredentials(
            FigShareOauthCredentials.class, Jenkins.getInstance(), ACL.SYSTEM,
            Collections.<DomainRequirement> emptyList());
    FigShareOauthCredentials credential = CredentialsMatchers.firstOrNull(credentials,
            CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsId)));

    this.credential = credential;
    if (null == credential) {
        LOGGER.warning(String.format(
                "Could not locate credential with ID %s. figshare integration is disabled for this notifier",
                credentialsId));
    }
}
 
开发者ID:biouno,项目名称:figshare-plugin,代码行数:30,代码来源:FigShareNotifier.java

示例11: getToken

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Plugins that want to refer to a {@link IdCredentials} should do so via ID string,
 * and use this method to resolve it and convert to {@link DockerRegistryToken}.
 *
 * @param context
 *       If you are a build step trying to access DockerHub in the context of a build/job,
 *       specify that job. Otherwise null. If you are scoped to something else, you might
 *       have to interact with {@link CredentialsProvider} directly.
 */
public @CheckForNull
DockerRegistryToken getToken(Item context) {
    if (credentialsId == null) {
        return null;
    }

    // as a build step, your access to credentials are constrained by what the build
    // can access, hence Jenkins.getAuthentication()

    List<DomainRequirement> requirements = Collections.emptyList();
    try {
        requirements = Collections.<DomainRequirement>singletonList(new HostnameRequirement(getEffectiveUrl().getHost()));
    } catch (IOException e) {
        // shrug off this error and move on. We are matching with ID anyway.
    }

    // look for subtypes that know how to create a token, such as Google Container Registry
    return AuthenticationTokens.convert(DockerRegistryToken.class, firstOrNull(CredentialsProvider.lookupCredentials(
            IdCredentials.class, context, Jenkins.getAuthentication(),requirements),
            allOf(AuthenticationTokens.matcher(DockerRegistryToken.class), withId(credentialsId))));
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:31,代码来源:DockerRegistryEndpoint.java

示例12: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
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()
                    )
            );
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:18,代码来源:DockerRegistryEndpoint.java

示例13: newKeyMaterialFactory

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Makes the key materials available locally and returns {@link KeyMaterialFactory} that gives you the parameters
 * needed to access it.
 */
public KeyMaterialFactory newKeyMaterialFactory(@Nonnull Item context, @Nonnull VirtualChannel target) throws IOException, InterruptedException {
    // as a build step, your access to credentials are constrained by what the build
    // can access, hence Jenkins.getAuthentication()
    DockerServerCredentials creds=null;
    if (credentialsId!=null) {
        List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(getUri()).build();
        domainRequirements.add(new DockerServerDomainRequirement());
        creds = CredentialsMatchers.firstOrNull(
                CredentialsProvider.lookupCredentials(
                        DockerServerCredentials.class, context, Jenkins.getAuthentication(),
                        domainRequirements),
                CredentialsMatchers.withId(credentialsId)
        );
    }

    // the directory needs to be outside workspace to avoid prying eyes
    FilePath dotDocker = dotDocker(target);
    dotDocker.mkdirs();
    // ServerKeyMaterialFactory.materialize creates a random subdir if one is needed:
    return newKeyMaterialFactory(dotDocker, creds);
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:26,代码来源:DockerServerEndpoint.java

示例14: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Stapler helper method.
 *
 * @param context
 *            the context.
 * @param remoteBase
 *            the remote base.
 * @return list box model.
 * @throws URISyntaxException 
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String serverAPIUrl) throws URISyntaxException {
    List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(serverAPIUrl).build();
    
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                    CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class),
                    CredentialsMatchers.instanceOf(StringCredentials.class)),
            CredentialsProvider.lookupCredentials(StandardCredentials.class,
                    context,
                    ACL.SYSTEM,
                    domainRequirements)
                    );
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:26,代码来源:GhprcGitHubAuth.java

示例15: getCredentials

import com.cloudbees.plugins.credentials.domains.DomainRequirement; //导入依赖的package包/类
/**
 * Get the {@link StandardCredentials}.
 *
 * @return the credentials matching the {@link #credentialsId} or {@code null} is {@code #credentialsId} is blank
 * @throws AbortException if no {@link StandardCredentials} matching {@link #credentialsId} is found
 */
@CheckForNull
private StandardCredentials getCredentials() throws AbortException {
    if (StringUtils.isBlank(credentialsId)) {
        return null;
    }
    StandardCredentials result = CredentialsMatchers.firstOrNull(
            CredentialsProvider.lookupCredentials(StandardCredentials.class,
                    Jenkins.getInstance(), ACL.SYSTEM, Collections.<DomainRequirement>emptyList()),
            CredentialsMatchers.withId(credentialsId)
    );
    if (result == null) {
        throw new AbortException("No credentials found for id \"" + credentialsId + "\"");
    }
    return result;
}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:22,代码来源:KubectlBuildWrapper.java


注:本文中的com.cloudbees.plugins.credentials.domains.DomainRequirement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。