本文整理汇总了Java中org.eclipse.aether.util.repository.AuthenticationBuilder类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationBuilder类的具体用法?Java AuthenticationBuilder怎么用?Java AuthenticationBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationBuilder类属于org.eclipse.aether.util.repository包,在下文中一共展示了AuthenticationBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toRemoteRepository
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
public static RemoteRepository toRemoteRepository(
String repoUrl, Optional<String> username, Optional<String> password) {
RemoteRepository.Builder repo =
new RemoteRepository.Builder(null, "default", repoUrl)
.setPolicy(new RepositoryPolicy(true, null, CHECKSUM_POLICY_FAIL));
if (username.isPresent() && password.isPresent()) {
Authentication authentication =
new AuthenticationBuilder()
.addUsername(username.get())
.addPassword(password.get())
.build();
repo.setAuthentication(authentication);
}
return repo.build();
}
示例2: toRepository
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private org.eclipse.aether.repository.RemoteRepository toRepository(String id,
RemoteRepository remoteRepository) {
org.eclipse.aether.repository.RemoteRepository.Builder builder = new org.eclipse.aether.repository.RemoteRepository.Builder(
id, "default", StringUtils.expandEnvironmentVars(remoteRepository.getUrl()));
if (remoteRepository.getAuthentication() != null) {
Authentication auth = remoteRepository.getAuthentication();
builder.setAuthentication(new AuthenticationBuilder()
.addUsername(StringUtils.expandEnvironmentVars(auth.getUsername()))
.addPassword(StringUtils.expandEnvironmentVars(auth.getPassword())).build())
.build();
}
return builder.build();
}
示例3: extractAuth
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private static Authentication extractAuth(final URL url) {
String userInfo = url.getUserInfo();
if (userInfo != null) {
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
int sep = userInfo.indexOf(':');
if (sep != -1) {
authBuilder.addUsername(userInfo.substring(0, sep));
authBuilder.addPassword(userInfo.substring(sep + 1));
}
else {
authBuilder.addUsername(userInfo);
}
return authBuilder.build();
}
return null;
}
示例4: getAuthentication
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
/**
* Returns user credentials for the server with the given id, as kept in Maven
* settings.
* <p>
* Refer to http://maven.apache.org/settings.html#Servers
*
* @param serverId the id of the server containing the authentication credentials
* @return the Authentication credentials for the given server with the given id
*
*/
protected Authentication getAuthentication(String serverId) {
Authentication authentication = null;
Server server = getDecryptedServer(serverId);
if (server != null) {
authentication = new AuthenticationBuilder()
.addUsername(server.getUsername())
.addPassword(server.getPassword())
.addPrivateKey(server.getPrivateKey(), server.getPassphrase())
.build();
}
return authentication;
}
示例5: readAuthentication
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private static Authentication readAuthentication(ConfigurationSection config) {
String username = config.getString("username");
String password = config.getString("password");
return new AuthenticationBuilder()
.addUsername(username)
.addPassword(password)
.build();
}
示例6: readAuthentication
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private static Authentication readAuthentication(Configuration config) {
String username = config.getString("username");
String password = config.getString("password");
return new AuthenticationBuilder()
.addUsername(username)
.addPassword(password)
.build();
}
示例7: createAuthenticationSelector
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private AuthenticationSelector createAuthenticationSelector(
SettingsDecryptionResult decryptedSettings) {
DefaultAuthenticationSelector selector = new DefaultAuthenticationSelector();
for (Server server : decryptedSettings.getServers()) {
AuthenticationBuilder auth = new AuthenticationBuilder();
auth.addUsername(server.getUsername()).addPassword(server.getPassword());
auth.addPrivateKey(server.getPrivateKey(), server.getPassphrase());
selector.add(server.getId(), auth.build());
}
return new ConservativeAuthenticationSelector(selector);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MavenSettings.java
示例8: createProxySelector
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private ProxySelector createProxySelector(
SettingsDecryptionResult decryptedSettings) {
DefaultProxySelector selector = new DefaultProxySelector();
for (Proxy proxy : decryptedSettings.getProxies()) {
Authentication authentication = new AuthenticationBuilder()
.addUsername(proxy.getUsername()).addPassword(proxy.getPassword())
.build();
selector.add(
new org.eclipse.aether.repository.Proxy(proxy.getProtocol(),
proxy.getHost(), proxy.getPort(), authentication),
proxy.getNonProxyHosts());
}
return selector;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:MavenSettings.java
示例9: buildRemoteRepository
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private RemoteRepository buildRemoteRepository(final String id, final String url, final Authentication auth,
final ArtifactRepositoryPolicy releasesPolicy, final ArtifactRepositoryPolicy snapshotsPolicy) {
RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url);
if (auth != null
&& auth.getUsername() != null
&& auth.getPassword() != null) {
builder.setAuthentication(new AuthenticationBuilder()
.addUsername(auth.getUsername())
.addPassword(auth.getPassword()).build());
}
builder.setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy()));
builder.setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy()));
RemoteRepository repository = builder.build();
final RemoteRepository mirror = session.getMirrorSelector().getMirror(repository);
if (mirror != null) {
final org.eclipse.aether.repository.Authentication mirrorAuth = session.getAuthenticationSelector()
.getAuthentication(mirror);
RemoteRepository.Builder mirrorBuilder = new RemoteRepository.Builder(mirror)
.setId(repository.getId())
.setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy()))
.setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy()));
if (mirrorAuth != null) {
mirrorBuilder.setAuthentication(mirrorAuth);
}
repository = mirrorBuilder.build();
}
Proxy proxy = session.getProxySelector().getProxy(repository);
if (proxy != null) {
repository = new RemoteRepository.Builder(repository).setProxy(proxy).build();
}
return repository;
}
示例10: testMvn1
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void testMvn1 () throws Exception
{
final ChannelTester ct = ChannelTester.create ( getWebContext (), "m1" );
ct.addAspect ( "mvn" );
ct.addAspect ( "maven.repo" );
ct.assignDeployGroup ( "m1" );
final String key = ct.getDeployKeys ().iterator ().next (); // get first
assertNotNull ( key );
final RepositorySystem system = MavenUtil.newRepositorySystem ();
final RepositorySystemSession session = MavenUtil.newRepositorySystemSession ( system );
Artifact jarArtifact = new DefaultArtifact ( "org.eclipse.packagedrone.testing", "test.felix1", "", "jar", "0.0.1-SNAPSHOT" );
jarArtifact = jarArtifact.setFile ( new File ( TEST_1_JAR ) );
Artifact pomArtifact = new SubArtifact ( jarArtifact, "", "pom" );
pomArtifact = pomArtifact.setFile ( new File ( TEST_1_POM ) );
Artifact srcArtifact = new SubArtifact ( jarArtifact, "sources", "jar" );
srcArtifact = srcArtifact.setFile ( new File ( TEST_1_SOURCES_JAR ) );
final AuthenticationBuilder ab = new AuthenticationBuilder ();
ab.addUsername ( "deploy" );
ab.addPassword ( key );
final Authentication auth = ab.build ();
final RemoteRepository distRepo = new RemoteRepository.Builder ( "test", "default", resolve ( String.format ( "/maven/%s", ct.getId () ) ) ).setAuthentication ( auth ).build ();
final DeployRequest deployRequest = new DeployRequest ();
deployRequest.addArtifact ( jarArtifact ).addArtifact ( pomArtifact ).addArtifact ( srcArtifact );
deployRequest.setRepository ( distRepo );
system.deploy ( session, deployRequest );
testUrl ( String.format ( "/maven/%s", ct.getId () ) ); // index page
// FIXME: check more data
}
示例11: remoteRepository
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
public void remoteRepository(ArtifactRepository repo) {
RemoteRepository.Builder builder = new RemoteRepository.Builder(repo.getId(), "default", repo.getUrl());
final Authentication mavenAuth = repo.getAuthentication();
if (mavenAuth != null && mavenAuth.getUsername() != null && mavenAuth.getPassword() != null) {
builder.setAuthentication(new AuthenticationBuilder()
.addUsername(mavenAuth.getUsername())
.addPassword(mavenAuth.getPassword()).build());
}
this.remoteRepositories.add(builder.build());
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:11,代码来源:MavenArtifactResolvingHelper.java
示例12: selectRepositoryToDeploy
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private RemoteRepository selectRepositoryToDeploy(Artifact artifactToDeploy) {
if (artifactToDeploy == null) {
throw new IllegalArgumentException("artifactToDeploy should not be null");
}
RemoteRepository.Builder snapRepoBuilder = new RemoteRepository.Builder("paas.push.snapshot.repo", "default", mvnConsumerConfigurer.getPushSnapshotRepositoryUrl());
RepositoryPolicy disabledRepo = null;
snapRepoBuilder.setReleasePolicy(disabledRepo);
Authentication snapshotRepositoryAuthen = new AuthenticationBuilder().addUsername(mvnConsumerConfigurer.getPushSnapshotRepositoryUser()).addPassword(
mvnConsumerConfigurer.getPushSnapshotRepositoryPassword()).build();
snapRepoBuilder.setAuthentication(snapshotRepositoryAuthen);
RemoteRepository.Builder releaseRepoBuilder = new RemoteRepository.Builder("paas.push.release.repo", "default", mvnConsumerConfigurer.getPushReleaseRepositoryUrl());
releaseRepoBuilder.setReleasePolicy(disabledRepo);
Authentication releaseRepositoryAuthen = new AuthenticationBuilder().addUsername(mvnConsumerConfigurer.getPushReleaseRepositoryUser()).addPassword(
mvnConsumerConfigurer.getPushReleaseRepositoryPassword()).build();
releaseRepoBuilder.setAuthentication(releaseRepositoryAuthen);
RemoteRepository result;
if (artifactToDeploy.isSnapshot()) {
result = snapRepoBuilder.build();
} else {
result = releaseRepoBuilder.build();
}
return result;
}
示例13: getRepository
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
/**
* Builds a RemoteRepository for resolving artifacts.
*
* @param altRepository
* @return
* @throws MojoExecutionException
* @throws MojoFailureException
*/
protected RemoteRepository getRepository(final String altRepository) throws MojoExecutionException, MojoFailureException {
if (getLog().isDebugEnabled()) {
getLog().debug("Creating remote Aether repository (to resolve remote artifacts) for: " + altRepository);
}
// Get an appropriate injected ArtifactRepository. (This resolves authentication in the 'normal' manner from Maven)
ArtifactRepository remoteArtifactRepo = getDeploymentRepository(altRepository);
if (getLog().isDebugEnabled()) {
getLog().debug("Resolved maven deployment repository. Transcribing to Aether Repository...");
}
RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(remoteArtifactRepo.getId(), remoteArtifactRepo.getLayout().getId(), remoteArtifactRepo.getUrl());
// Add authentication.
if (remoteArtifactRepo.getAuthentication() != null) {
if (getLog().isDebugEnabled()) {
getLog().debug("Maven deployment repsoitory has Authentication. Transcribing to Aether Authentication...");
}
remoteRepoBuilder.setAuthentication(new AuthenticationBuilder().addUsername(remoteArtifactRepo.getAuthentication().getUsername())
.addPassword(remoteArtifactRepo.getAuthentication().getPassword())
.addPrivateKey(remoteArtifactRepo.getAuthentication().getPrivateKey(), remoteArtifactRepo.getAuthentication().getPassphrase())
.build());
}
return remoteRepoBuilder.build();
}
开发者ID:egineering-llc,项目名称:gitflow-helper-maven-plugin,代码行数:35,代码来源:AbstractGitflowBasedRepositoryMojo.java
示例14: extractAuth
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
private static Authentication extractAuth(URL url) {
String userInfo = url.getUserInfo();
if (userInfo != null) {
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
int sep = userInfo.indexOf(':');
if (sep != -1) {
authBuilder.addUsername(userInfo.substring(0, sep));
authBuilder.addPassword(userInfo.substring(sep + 1));
} else {
authBuilder.addUsername(userInfo);
}
return authBuilder.build();
}
return null;
}
示例15: testMvn1
import org.eclipse.aether.util.repository.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void testMvn1 () throws Exception
{
final ChannelTester ct = ChannelTester.create ( getWebContext (), "m1" );
ct.addAspect ( "mvn" );
ct.addAspect ( "maven.repo" );
ct.assignDeployGroup ( "m1" );
final String key = ct.getDeployKeys ().iterator ().next (); // get first
assertNotNull ( key );
final RepositorySystem system = MavenUtil.newRepositorySystem ();
final RepositorySystemSession session = MavenUtil.newRepositorySystemSession ( system );
Artifact jarArtifact = new DefaultArtifact ( "de.dentrassi", "test.bundle1", "", "jar", "1.0.0-SNAPSHOT" );
jarArtifact = jarArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT.jar" ) );
Artifact pomArtifact = new SubArtifact ( jarArtifact, "", "pom" );
pomArtifact = pomArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT.pom" ) );
Artifact srcArtifact = new SubArtifact ( jarArtifact, "sources", "jar" );
srcArtifact = srcArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT-sources.jar" ) );
final AuthenticationBuilder ab = new AuthenticationBuilder ();
ab.addUsername ( "deploy" );
ab.addPassword ( key );
final Authentication auth = ab.build ();
final RemoteRepository distRepo = new RemoteRepository.Builder ( "test", "default", resolve ( String.format ( "/maven/%s", ct.getId () ) ) ).setAuthentication ( auth ).build ();
final DeployRequest deployRequest = new DeployRequest ();
deployRequest.addArtifact ( jarArtifact ).addArtifact ( pomArtifact ).addArtifact ( srcArtifact );
deployRequest.setRepository ( distRepo );
system.deploy ( session, deployRequest );
testUrl ( String.format ( "/maven/%s", ct.getId () ) ); // index page
// FIXME: check more data
}