org.apache.maven.artifact.repository.Authentication.getPrivateKey()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.apache.maven.artifact.repository.Authentication.getPrivateKey()方法的一些代码示例,展示了Authentication.getPrivateKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authentication.getPrivateKey()方法的具体详情如下:
包路径:org.apache.maven.artifact.repository.Authentication
类名称:Authentication
方法名:getPrivateKey

Authentication.getPrivateKey介绍

[英]Get the absolute path to the private key file.
[中]获取私钥文件的绝对路径。

代码示例

代码示例来源:origin: apache/maven

private static Authentication toAuthentication( org.apache.maven.artifact.repository.Authentication auth )
{
  Authentication result = null;
  if ( auth != null )
  {
    AuthenticationBuilder authBuilder = new AuthenticationBuilder();
    authBuilder.addUsername( auth.getUsername() ).addPassword( auth.getPassword() );
    authBuilder.addPrivateKey( auth.getPrivateKey(), auth.getPassphrase() );
    result = authBuilder.build();
  }
  return result;
}

代码示例来源:origin: io.takari.maven.plugins/takari-lifecycle-plugin

private static Authentication toAuthentication(org.apache.maven.artifact.repository.Authentication auth) {
 Authentication result = null;
 if (auth != null) {
  AuthenticationBuilder authBuilder = new AuthenticationBuilder();
  authBuilder.addUsername(auth.getUsername()).addPassword(auth.getPassword());
  authBuilder.addPrivateKey(auth.getPrivateKey(), auth.getPassphrase());
  result = authBuilder.build();
 }
 return result;
}

代码示例来源:origin: takari/takari-lifecycle

private static Authentication toAuthentication(org.apache.maven.artifact.repository.Authentication auth) {
 Authentication result = null;
 if (auth != null) {
  AuthenticationBuilder authBuilder = new AuthenticationBuilder();
  authBuilder.addUsername(auth.getUsername()).addPassword(auth.getPassword());
  authBuilder.addPrivateKey(auth.getPrivateKey(), auth.getPassphrase());
  result = authBuilder.build();
 }
 return result;
}

代码示例来源:origin: egineering-llc/gitflow-helper-maven-plugin

/**
 * Builds a RemoteRepository for resolving artifacts.
 *
 * @param altRepository the repository identifier or alt-syntax specification
 * @return the resolve remote repository
 * @throws MojoExecutionException if the provided repository specification defines an invalid repository layout
 * @throws MojoFailureException if the provided repository specification is invalid
 */
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();
}

相关文章