Package org.sonatype.nexus.proxy.repository

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


  {
    int rscChange = aProxyRepository.getRemoteStorageContext().getGeneration();

    // and the problem now
    // change the global proxy
    final DefaultRemoteHttpProxySettings httpProxySettings = new DefaultRemoteHttpProxySettings();
    httpProxySettings.setHostname("192.168.1.1");
    httpProxySettings.setPort(1234);

    RemoteProxySettings proxy = applicationConfiguration.getGlobalRemoteStorageContext().getRemoteProxySettings();
    proxy.setHttpProxySettings(httpProxySettings);

    // TODO: this is the spurious part!!! Make it not needed! Config framework DOES know it changed!
View Full Code Here


  {
    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

  {
    Configuration config = nexusConfiguration.getConfigurationModel();

    assertEquals(null, config.getRemoteProxySettings());

    final DefaultRemoteHttpProxySettings httpProxySettings = new DefaultRemoteHttpProxySettings();
    httpProxySettings.setHostname("http.proxy.com");
    httpProxySettings.setPort(1234);

    final DefaultRemoteHttpProxySettings httpsProxySettings = new DefaultRemoteHttpProxySettings();
    httpsProxySettings.setHostname("https.proxy.com");
    httpsProxySettings.setPort(4321);

    globalRemoteProxySettings.setHttpProxySettings(httpProxySettings);
    globalRemoteProxySettings.setHttpsProxySettings(httpsProxySettings);

    nexusConfiguration.saveConfiguration();
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

    final RemoteAuthenticationSettings remoteAuthenticationSettings =
        new UsernamePasswordRemoteAuthenticationSettings("user", "pass");
    customizer.applyAuthenticationConfig(builder, remoteAuthenticationSettings, null);

    final DefaultRemoteHttpProxySettings httpProxy = new DefaultRemoteHttpProxySettings();
    httpProxy.setHostname("http-proxy");
    httpProxy.setPort(8080);
    httpProxy.setProxyAuthentication(new UsernamePasswordRemoteAuthenticationSettings("http-proxy", "http-pass"));

    final DefaultRemoteHttpProxySettings httpsProxy = new DefaultRemoteHttpProxySettings();
    httpsProxy.setHostname("https-proxy");
    httpsProxy.setPort(9090);
    httpsProxy.setProxyAuthentication(new UsernamePasswordRemoteAuthenticationSettings("https-proxy", "https-pass"));

    final DefaultRemoteProxySettings remoteProxySettings = new DefaultRemoteProxySettings();
    remoteProxySettings.setHttpProxySettings(httpProxy);
    remoteProxySettings.setHttpsProxySettings(httpsProxy);
View Full Code Here

      }
    });

    GlobalRemoteProxySettings settings = lookup(GlobalRemoteProxySettings.class);

    final DefaultRemoteHttpProxySettings httpProxySettings = new DefaultRemoteHttpProxySettings();
    httpProxySettings.setHostname("foo.bar.com");
    httpProxySettings.setPort(1234);

    settings.setHttpProxySettings(httpProxySettings);

    cfg.saveConfiguration();
View Full Code Here

TOP

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

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.