org.sonatype.aether.repository.Authentication类的使用及代码示例

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

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

Authentication介绍

[英]The authentication to use for accessing a protected resource. Note: Instances of this class are immutable and the exposed mutators return new objects rather than changing the current instance.
[中]用于访问受保护资源的身份验证*注意:*此类的实例是不可变的,公开的变体返回新对象,而不是更改当前实例。

代码示例

代码示例来源: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: 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-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: 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: 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.sonatype.aether/aether-api

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

代码示例来源: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

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: org.sonatype.aether/org.motechproject.aether-api

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

代码示例来源: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: 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: io.fabric8.fab/fab-core

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

代码示例来源: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: sonatype/sonatype-aether

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

代码示例来源: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: 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.fusesource.fabric.fab/fab-core

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

代码示例来源: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: org.sonatype.aether/aether-impl

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

相关文章