Examples of NtlmRemoteAuthenticationSettings


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

      Credentials credentials = null;
      if (ras instanceof ClientSSLRemoteAuthenticationSettings) {
        throw new IllegalArgumentException("SSL client authentication not yet supported!");
      }
      else if (ras instanceof NtlmRemoteAuthenticationSettings) {
        final NtlmRemoteAuthenticationSettings nras = (NtlmRemoteAuthenticationSettings) ras;
        // Using NTLM auth, adding it as first in policies
        authorisationPreference.add(0, AuthSchemes.NTLM);
        log.debug("{} authentication setup for NTLM domain '{}'", authScope, nras.getNtlmDomain());
        credentials = new NTCredentials(
            nras.getUsername(), nras.getPassword(), nras.getNtlmHost(), nras.getNtlmDomain()
        );
      }
      else if (ras instanceof UsernamePasswordRemoteAuthenticationSettings) {
        final UsernamePasswordRemoteAuthenticationSettings uras =
            (UsernamePasswordRemoteAuthenticationSettings) ras;
View Full Code Here

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

    if (settings instanceof ClientSSLRemoteAuthenticationSettings) {
      // huh?
    }
    else if (settings instanceof NtlmRemoteAuthenticationSettings) {
      NtlmRemoteAuthenticationSettings up = (NtlmRemoteAuthenticationSettings) settings;

      auth.setUsername(up.getUsername());

      auth.setPassword(PASSWORD_PLACE_HOLDER);

      auth.setNtlmHost(up.getNtlmHost());

      auth.setNtlmDomain(up.getNtlmDomain());

    }
    else if (settings instanceof UsernamePasswordRemoteAuthenticationSettings) {
      UsernamePasswordRemoteAuthenticationSettings up = (UsernamePasswordRemoteAuthenticationSettings) settings;

      auth.setUsername(up.getUsername());

      auth.setPassword(PASSWORD_PLACE_HOLDER);
    }

    return auth;
View Full Code Here

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

      if (StringUtils.isNotBlank(model.getKeyStore()) || StringUtils.isNotBlank(model.getTrustStore())) {
        return new ClientSSLRemoteAuthenticationSettings(new File(model.getTrustStore()), model
            .getTrustStorePassword(), new File(model.getKeyStore()), model.getKeyStorePassword());
      }
      else if (StringUtils.isNotBlank(model.getNtlmDomain())) {
        return new NtlmRemoteAuthenticationSettings(model.getUsername(), model.getPassword(), model
            .getNtlmDomain(), model.getNtlmHost());
      }
      else {
        return new UsernamePasswordRemoteAuthenticationSettings(model.getUsername(), model.getPassword());
      }
View Full Code Here

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

    }
    else {
      CRemoteAuthentication remoteAuthentication = new CRemoteAuthentication();

      if (settings instanceof NtlmRemoteAuthenticationSettings) {
        NtlmRemoteAuthenticationSettings up = (NtlmRemoteAuthenticationSettings) settings;

        remoteAuthentication.setUsername(up.getUsername());

        remoteAuthentication.setPassword(up.getPassword());

        remoteAuthentication.setNtlmDomain(up.getNtlmDomain());

        remoteAuthentication.setNtlmHost(up.getNtlmHost());
      }
      else if (settings instanceof UsernamePasswordRemoteAuthenticationSettings) {
        UsernamePasswordRemoteAuthenticationSettings up =
            (UsernamePasswordRemoteAuthenticationSettings) settings;

        remoteAuthentication.setUsername(up.getUsername());

        remoteAuthentication.setPassword(up.getPassword());
      }
      else if (settings instanceof ClientSSLRemoteAuthenticationSettings) {
        ClientSSLRemoteAuthenticationSettings cs = (ClientSSLRemoteAuthenticationSettings) settings;

        remoteAuthentication.setKeyStore(cs.getKeyStore().getAbsolutePath());
View Full Code Here

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

    }

    // remote auth is NTLM
    {
      final DefaultRemoteStorageContext drsc = new DefaultRemoteStorageContext(null);
      drsc.setRemoteAuthenticationSettings(new NtlmRemoteAuthenticationSettings("a", "b", "c", "d"));
      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
TOP
Copyright © 2018 www.massapi.com. 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.