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

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

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

Authentication.getUsername介绍

[英]Gets the username.
[中]获取用户名。

代码示例

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

@Override
public String toString()
{
  return getUsername();
}

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

@Override
public String toString()
{
  return getUsername();
}

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

@Override
public String toString()
{
  return getUsername();
}

代码示例来源:origin: io.fabric8.fab/fab-core

text = text.replaceFirst(String.format("%s:%s@", authentication.getUsername(), authentication.getPassword()), "");

代码示例来源:origin: org.fusesource.fabric.fab/fab-core

text = text.replaceFirst(String.format("%s:%s@", authentication.getUsername(), authentication.getPassword()), "");

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

if ( auth != null )
  buffer.append( " as " ).append( auth.getUsername() );
  if ( auth != null )
    buffer.append( " as " ).append( auth.getUsername() );

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

if ( auth != null )
  buffer.append( " as " ).append( auth.getUsername() );
  if ( auth != null )
    buffer.append( " as " ).append( auth.getUsername() );

代码示例来源:origin: io.hawt/hawtio-aether

text = text.replaceFirst(String.format("%s:%s@", authentication.getUsername(), authentication.getPassword()), "");

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

/**
 * Creates a new authentication with the specified properties.
 * @param auth The authentication object.
 */
@SuppressWarnings("PMD.NullAssignment")
public RepositoryAuthentication(final Authentication auth) {
  this.username = auth.getUsername();
  if (auth.getPassword() == null) {
    this.password = null;
  } else {
    this.password = auth.getPassword().toCharArray();
  }
  this.privatekeyfile = auth.getPrivateKeyFile();
  if (auth.getPassphrase() == null) {
    this.passphrase = null;
  } else {
    this.passphrase = auth.getPassphrase().toCharArray();
  }
}

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

private Realm getRealm( RemoteRepository repository, String credentialEncoding )
{
  Realm realm = null;
  Authentication a = repository.getAuthentication();
  if ( a != null && a.getUsername() != null )
  {
    realm = new Realm.RealmBuilder().setPrincipal( a.getUsername() ).setPassword(
      a.getPassword() ).setUsePreemptiveAuth( false ).setEnconding( credentialEncoding ).build();
  }
  return realm;
}

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

private Realm getRealm( RemoteRepository repository, String credentialEncoding )
{
  Realm realm = null;
  Authentication a = repository.getAuthentication();
  if ( a != null && a.getUsername() != null )
  {
    realm = new Realm.RealmBuilder().setPrincipal( a.getUsername() ).setPassword(
      a.getPassword() ).setUsePreemptiveAuth( false ).setEnconding( credentialEncoding ).build();
  }
  return realm;
}

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

private void appendAuth( StringBuilder buffer, Authentication auth )
{
  if ( auth != null )
  {
    SimpleDigest digest = new SimpleDigest();
    digest.update( auth.getUsername() );
    digest.update( auth.getPassword() );
    digest.update( auth.getPrivateKeyFile() );
    digest.update( auth.getPassphrase() );
    buffer.append( digest.digest() ).append( '@' );
  }
}

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

private void appendAuth( StringBuilder buffer, Authentication auth )
{
  if ( auth != null )
  {
    SimpleDigest digest = new SimpleDigest();
    digest.update( auth.getUsername() );
    digest.update( auth.getPassword() );
    digest.update( auth.getPrivateKeyFile() );
    digest.update( auth.getPassphrase() );
    buffer.append( digest.digest() ).append( '@' );
  }
}

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

private ProxyServer getProxy( RemoteRepository repository, String credentialEncoding )
{
  ProxyServer proxyServer = null;
  Proxy p = repository.getProxy();
  if ( p != null )
  {
    Authentication a = p.getAuthentication();
    boolean useSSL = repository.getProtocol().equalsIgnoreCase( "https" ) ||
      repository.getProtocol().equalsIgnoreCase( "dav:https" );
    if ( a == null )
    {
      proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort() );
    }
    else
    {
      proxyServer =
        new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort(), a.getUsername(),
                 a.getPassword() );
      proxyServer.setEncoding( credentialEncoding );
    }
  }
  return proxyServer;
}

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

private ProxyServer getProxy( RemoteRepository repository, String credentialEncoding )
{
  ProxyServer proxyServer = null;
  Proxy p = repository.getProxy();
  if ( p != null )
  {
    Authentication a = p.getAuthentication();
    boolean useSSL = repository.getProtocol().equalsIgnoreCase( "https" ) ||
      repository.getProtocol().equalsIgnoreCase( "dav:https" );
    if ( a == null )
    {
      proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort() );
    }
    else
    {
      proxyServer =
        new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort(), a.getUsername(),
                 a.getPassword() );
      proxyServer.setEncoding( credentialEncoding );
    }
  }
  return proxyServer;
}

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

private AuthenticationInfo getAuthenticationInfo( RemoteRepository repository )
{
  AuthenticationInfo auth = null;
  Authentication a = repository.getAuthentication();
  if ( a != null )
  {
    auth = new AuthenticationInfo();
    auth.setUserName( a.getUsername() );
    auth.setPassword( a.getPassword() );
    auth.setPrivateKey( a.getPrivateKeyFile() );
    auth.setPassphrase( a.getPassphrase() );
  }
  return auth;
}

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

private ProxyInfoProvider getProxy( RemoteRepository repository )
{
  ProxyInfoProvider proxy = null;
  Proxy p = repository.getProxy();
  if ( p != null )
  {
    final ProxyInfo prox = new ProxyInfo();
    prox.setType( p.getType() );
    prox.setHost( p.getHost() );
    prox.setPort( p.getPort() );
    if ( p.getAuthentication() != null )
    {
      prox.setUserName( p.getAuthentication().getUsername() );
      prox.setPassword( p.getAuthentication().getPassword() );
    }
    proxy = new ProxyInfoProvider()
    {
      public ProxyInfo getProxyInfo( String protocol )
      {
        return prox;
      }
    };
  }
  return proxy;
}

相关文章