本文整理汇总了Java中com.cloudbees.plugins.credentials.CredentialsMatcher类的典型用法代码示例。如果您正苦于以下问题:Java CredentialsMatcher类的具体用法?Java CredentialsMatcher怎么用?Java CredentialsMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CredentialsMatcher类属于com.cloudbees.plugins.credentials包,在下文中一共展示了CredentialsMatcher类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import com.cloudbees.plugins.credentials.CredentialsMatcher; //导入依赖的package包/类
@Before
public void setUp() {
PowerMockito.mockStatic(CredentialsMatchers.class);
PowerMockito.mockStatic(SystemCredentialsProvider.class);
PowerMockito.mockStatic(DefaultAWSCredentialsProviderChain.class);
when(CredentialsMatchers.firstOrNull(any(Iterable.class), any(CredentialsMatcher.class))).thenReturn(mockCBCreds);
when(mockCBCreds.getCredentials()).thenReturn(mockAWSCreds);
when(mockCBCreds.getCredentialsDescriptor()).thenReturn(codeBuildDescriptor);
when(mockCBCreds.getProxyHost()).thenReturn(proxyHost);
when(mockCBCreds.getProxyPort()).thenReturn(proxyPort);
when(mockAWSCreds.getAWSAccessKeyId()).thenReturn("a");
when(mockAWSCreds.getAWSSecretKey()).thenReturn("s");
when(SystemCredentialsProvider.getInstance()).thenReturn(mockSysCreds);
when(DefaultAWSCredentialsProviderChain.getInstance()).thenReturn(cpChain);
}
开发者ID:awslabs,项目名称:aws-codebuild-jenkins-plugin,代码行数:18,代码来源:AWSClientFactoryTest.java
示例2: getCredentials
import com.cloudbees.plugins.credentials.CredentialsMatcher; //导入依赖的package包/类
public static BrowserStackCredentials getCredentials(final AbstractItem buildItem, final String credentialsId) {
List<BrowserStackCredentials> available = availableCredentials(buildItem);
if (available.isEmpty()) {
return null;
}
CredentialsMatcher matcher;
if (credentialsId != null) {
matcher = CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsId));
} else {
matcher = CredentialsMatchers.always();
}
return CredentialsMatchers.firstOrDefault(
available,
matcher,
available.get(0));
}
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:19,代码来源:BrowserStackCredentials.java
示例3: getCredentials
import com.cloudbees.plugins.credentials.CredentialsMatcher; //导入依赖的package包/类
public static ConduitCredentials getCredentials(Job owner, String credentialsID) {
List<ConduitCredentials> available = availableCredentials(owner);
if (available.size() == 0) {
return null;
}
CredentialsMatcher matcher;
if (credentialsID != null) {
matcher = CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsID));
} else {
matcher = CredentialsMatchers.always();
}
return CredentialsMatchers.firstOrDefault(
available,
matcher,
available.get(0)
);
}
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:18,代码来源:ConduitCredentialsDescriptor.java
示例4: matcher
import com.cloudbees.plugins.credentials.CredentialsMatcher; //导入依赖的package包/类
/**
* Builds a matcher for credentials that can be converted into the supplied token type.
*
* @param context the context that an authentication token is required in.
* @param <T> the type of token.
* @return a matcher for the type of token.
* @since 1.2
*/
public static <T> CredentialsMatcher matcher(AuthenticationTokenContext<T> context) {
List<CredentialsMatcher> matchers = new ArrayList<CredentialsMatcher>();
for (AuthenticationTokenSource<?, ?> source : ExtensionList.lookup(AuthenticationTokenSource.class)) {
if (source.fits(context)) {
matchers.add(source.matcher());
}
}
return matchers.isEmpty()
? CredentialsMatchers.never()
: CredentialsMatchers.anyOf(matchers.toArray(new CredentialsMatcher[matchers.size()]));
}
开发者ID:jenkinsci,项目名称:authentication-tokens-plugin,代码行数:20,代码来源:AuthenticationTokens.java
示例5: lookupCredentials
import com.cloudbees.plugins.credentials.CredentialsMatcher; //导入依赖的package包/类
private UsernamePasswordCredentials lookupCredentials(String credentialId) {
List<UsernamePasswordCredentials> credentials = CredentialsProvider.lookupCredentials(UsernamePasswordCredentials.class,
Jenkins.getInstance(), ACL.SYSTEM, Collections.<DomainRequirement>emptyList());
CredentialsMatcher matcher = CredentialsMatchers.withId(credentialId);
return CredentialsMatchers.firstOrNull(credentials, matcher);
}
开发者ID:empear-analytics,项目名称:codescene-jenkins-plugin,代码行数:7,代码来源:CodeSceneBuilder.java
示例6: matcher
import com.cloudbees.plugins.credentials.CredentialsMatcher; //导入依赖的package包/类
/**
* Produces a {@link CredentialsMatcher} for this specific {@link AuthenticationTokenSource}.
* Implementations only need to override this method when they can only process a sub-set of the
* credential class that they convert. For example if {@link UsernamePasswordCredentials} are converted
* into a specific authentication token, but only for those cases where there is a password and the username
* is between 3 and 8 lowercase letters then the specific source implementation would likely override
* this method and return a more specific {@link CredentialsMatcher} in order to avoid {@link #convert(Credentials)}
* having to throw an {@link AuthenticationTokenException}.
*
* @return the {@link CredentialsMatcher} for this source.
*/
@NonNull
@OverrideMustInvoke(When.ANYTIME)
public CredentialsMatcher matcher() {
return CredentialsMatchers.instanceOf(credentialsClass);
}
开发者ID:jenkinsci,项目名称:authentication-tokens-plugin,代码行数:17,代码来源:AuthenticationTokenSource.java
注:本文中的com.cloudbees.plugins.credentials.CredentialsMatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论