org.sonatype.aether.repository.Authentication.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(143)

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

Authentication.<init>介绍

[英]Creates a basic username+password authentication.
[中]创建基本用户名+密码身份验证。

代码示例

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

public Authentication getAuthentication() {
 Authentication auth = null;
 if (this.username != null && this.password != null) {
  auth = new Authentication(this.username, this.password);
 }
 return auth;
}

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

public Proxy getProxy() {
 if (isNotBlank(proxyHost) && proxyPort != null) {
  if (isNotBlank(proxyLogin)) {
   return new Proxy(proxyProtocol, proxyHost, proxyPort,
       new Authentication(proxyLogin, proxyPassword));
  } else {
   return new Proxy(proxyProtocol, proxyHost, proxyPort, null);
  }
 }
 return null;
}

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

public void setProxy(URL proxyUrl, String proxyUser, String proxyPassword) {
 Authentication auth = new Authentication(proxyUser, proxyPassword);
 Proxy proxy = new Proxy(proxyUrl.getProtocol(), proxyUrl.getHost(), proxyUrl.getPort(), auth);
 synchronized (repos) {
  for (RemoteRepository repo : repos) {
   repo.setProxy(proxy);
  }
 }
}

代码示例来源:origin: jcabi/jcabi-aether

/**
   * Get the Authentication object.
   * @return The Authentication object.
   */
  public Authentication getAuthentication() {
    return new Authentication(
      this.username,
      this.password,
      this.privatekeyfile,
      this.passphrase
    );
  }
}

代码示例来源:origin: org.sonatype.aether/aether-api

private Authentication setPassphraseInternal( char[] passphrase )
{
  if ( Arrays.equals( this.passphrase, passphrase ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.sonatype.aether/aether-api

private Authentication setPasswordInternal( char[] password )
{
  if ( Arrays.equals( this.password, password ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.sonatype.aether/org.motechproject.aether-api

private Authentication setPassphraseInternal( char[] passphrase )
{
  if ( Arrays.equals( this.passphrase, passphrase ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: sonatype/sonatype-aether

private Authentication setPassphraseInternal( char[] passphrase )
{
  if ( Arrays.equals( this.passphrase, passphrase ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: sonatype/sonatype-aether

private Authentication setPasswordInternal( char[] password )
{
  if ( Arrays.equals( this.password, password ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.sonatype.aether/org.motechproject.aether-api

private Authentication setPasswordInternal( char[] password )
{
  if ( Arrays.equals( this.password, password ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.apache.openejb/openejb-provisionning

private Authentication getAuthentication(Map<String, String> proxy) {
  // user, pass
  if (proxy.containsKey("user")) {
    return new Authentication(proxy.get("user"), proxy.get("pass"));
  }
  return null;
}

代码示例来源:origin: org.sonatype.aether/org.motechproject.aether-api

/**
 * Sets the username to use for authentication.
 * 
 * @param username The username, may be {@code null}.
 * @return The new authentication, never {@code null}.
 */
public Authentication setUsername( String username )
{
  if ( eq( this.username, username ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.sonatype.aether/aether-api

/**
 * Sets the username to use for authentication.
 * 
 * @param username The username, may be {@code null}.
 * @return The new authentication, never {@code null}.
 */
public Authentication setUsername( String username )
{
  if ( eq( this.username, username ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.sonatype.aether/org.motechproject.aether-api

/**
 * Sets the path to the private key file to use for authentication.
 * 
 * @param privateKeyFile The path to the private key file, may be {@code null}.
 * @return The new authentication, never {@code null}.
 */
public Authentication setPrivateKeyFile( String privateKeyFile )
{
  if ( eq( this.privateKeyFile, privateKeyFile ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: org.sonatype.aether/aether-api

/**
 * Sets the path to the private key file to use for authentication.
 * 
 * @param privateKeyFile The path to the private key file, may be {@code null}.
 * @return The new authentication, never {@code null}.
 */
public Authentication setPrivateKeyFile( String privateKeyFile )
{
  if ( eq( this.privateKeyFile, privateKeyFile ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: sonatype/sonatype-aether

/**
 * Sets the path to the private key file to use for authentication.
 * 
 * @param privateKeyFile The path to the private key file, may be {@code null}.
 * @return The new authentication, never {@code null}.
 */
public Authentication setPrivateKeyFile( String privateKeyFile )
{
  if ( eq( this.privateKeyFile, privateKeyFile ) )
  {
    return this;
  }
  return new Authentication( username, privateKeyFile, password, passphrase );
}

代码示例来源:origin: stackoverflow.com

Identity identity = injector.getInstance(Identity.class);
Authentication auth = new Authentication();
Identity authenticated = auth.authenticate("login","password");
identity.setUid(authenticated.getUid());
identity.setName(authenticated.getName());

代码示例来源:origin: org.jboss.forge/maven-impl

public static org.sonatype.aether.repository.Proxy convertFromMavenProxy(org.apache.maven.settings.Proxy proxy)
{
 org.sonatype.aether.repository.Proxy result = null;
 if (proxy != null)
 {
   Authentication auth = new Authentication(proxy.getUsername(), proxy.getPassword());
   result = new org.sonatype.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
 }
 return result;
}

代码示例来源:origin: airlift/airship

private static RemoteRepository makeRemoteRepository(Metadata.Repository info, Server server, boolean snapshot)
{
  return new RemoteRepository(info.getId(), "default", info.getUri())
      .setPolicy(true, new RepositoryPolicy(snapshot, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_FAIL))
      .setPolicy(false, new RepositoryPolicy(!snapshot, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_FAIL))
      .setAuthentication(new Authentication(server.getUsername(), server.getPassword()));
}

代码示例来源:origin: org.jboss.forge/maven-impl

static RemoteRepository convertToMavenRepo(final DependencyRepository repo, final Settings settings)
{
 RemoteRepository remoteRepository = new RemoteRepository(repo.getId(), "default", repo.getUrl());
 Proxy activeProxy = settings.getActiveProxy();
 if (activeProxy != null)
 {
   Authentication auth = new Authentication(activeProxy.getUsername(), activeProxy.getPassword());
   remoteRepository.setProxy(new org.sonatype.aether.repository.Proxy(activeProxy.getProtocol(), activeProxy
       .getHost(), activeProxy.getPort(), auth));
 }
 return remoteRepository;
}

相关文章