Package org.sonatype.nexus.proxy.repository

Examples of org.sonatype.nexus.proxy.repository.RemoteHttpProxySettings


  {
    if (settings == null || StringUtils.isEmpty(settings.getProxyHostname())) {
      return null;
    }

    final RemoteHttpProxySettings result = new DefaultRemoteHttpProxySettings();

    result.setHostname(settings.getProxyHostname());
    result.setPort(settings.getProxyPort());

    if (settings.getAuthentication() != null) {
      CRemoteAuthentication auth = new CRemoteAuthentication();

      auth.setUsername(settings.getAuthentication().getUsername());

      auth.setPassword(getActualPassword(settings.getAuthentication().getPassword(), oldPassword));

      auth.setNtlmDomain(settings.getAuthentication().getNtlmDomain());

      auth.setNtlmHost(settings.getAuthentication().getNtlmHost());

      result.setProxyAuthentication(
          getAuthenticationInfoConverter().convertAndValidateFromModel(auth));
    }
    else {
      result.setProxyAuthentication(null);
    }

    return result;
  }
View Full Code Here


  {
    if (model == null) {
      return null;
    }

    final RemoteHttpProxySettings settings = new DefaultRemoteHttpProxySettings();

    settings.setHostname(model.getProxyHostname());
    settings.setPort(model.getProxyPort());
    settings.setProxyAuthentication(
        authenticationInfoConverter.convertAndValidateFromModel(model.getAuthentication())
    );

    return settings;
  }
View Full Code Here

      Assert.assertTrue("NTLM target auth-proxy set", testSubject.reuseConnectionsNeeded(drsc));
    }

    // HTTP proxy is NTLM
    {
      final RemoteHttpProxySettings http = new DefaultRemoteHttpProxySettings();
      http.setProxyAuthentication(new NtlmRemoteAuthenticationSettings("a", "b", "c", "d"));
      final RemoteHttpProxySettings https = new DefaultRemoteHttpProxySettings();
      when(remoteProxySettings.getHttpProxySettings()).thenReturn(http);
      when(remoteProxySettings.getHttpsProxySettings()).thenReturn(https);
      Assert.assertTrue("NTLM HTTP proxy auth-proxy set",
              testSubject.reuseConnectionsNeeded(globalRemoteStorageContext));
    }

    // HTTPS proxy is NTLM
    {
      final RemoteHttpProxySettings http = new DefaultRemoteHttpProxySettings();
      final RemoteHttpProxySettings https = new DefaultRemoteHttpProxySettings();
      https.setProxyAuthentication(new NtlmRemoteAuthenticationSettings("a", "b", "c", "d"));
      when(remoteProxySettings.getHttpProxySettings()).thenReturn(http);
      when(remoteProxySettings.getHttpsProxySettings()).thenReturn(https);
      Assert.assertTrue("NTLM HTTPS proxy auth-proxy set",
              testSubject.reuseConnectionsNeeded(globalRemoteStorageContext));
    }
View Full Code Here

    inspect(e);
  }

  protected void inspect(final Event<?> evt) {
    // FIXME: Sort out what to do with http/https here
    RemoteHttpProxySettings httpProxySettings = globalRemoteProxySettings.getHttpProxySettings();

    if (httpProxySettings != null && httpProxySettings.isEnabled()) {
      String username = null;
      String password = null;

      final RemoteAuthenticationSettings authentication = httpProxySettings.getProxyAuthentication();

      if (authentication != null
          && UsernamePasswordRemoteAuthenticationSettings.class.isAssignableFrom(authentication.getClass())) {
        username = ((UsernamePasswordRemoteAuthenticationSettings) authentication).getUsername();
        password = ((UsernamePasswordRemoteAuthenticationSettings) authentication).getPassword();
      }

      final String hostname = httpProxySettings.getHostname();
      final int port = httpProxySettings.getPort();
      final Set<String> nonProxyHosts = globalRemoteProxySettings.getNonProxyHosts();

      log.debug(
          "Configure P2 proxy using global http proxy settings: hostname={}, port={}, username={}, nonProxyHosts={}",
          hostname, port, username, nonProxyHosts
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.repository.RemoteHttpProxySettings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.