Package org.sonatype.nexus.proxy.repository

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


        credentials = new NTCredentials(
            nras.getUsername(), nras.getPassword(), nras.getNtlmHost(), nras.getNtlmDomain()
        );
      }
      else if (ras instanceof UsernamePasswordRemoteAuthenticationSettings) {
        final UsernamePasswordRemoteAuthenticationSettings uras =
            (UsernamePasswordRemoteAuthenticationSettings) ras;
        log.debug("{} authentication setup for remote storage with username '{}'", authScope,
            uras.getUsername());
        credentials = new UsernamePasswordCredentials(uras.getUsername(), uras.getPassword());
      }

      if (credentials != null) {
        if (proxyHost != null) {
          builder.setCredentials(new AuthScope(proxyHost), credentials);
View Full Code Here


      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

        String username = null;
        String password = null;
        final RemoteAuthenticationSettings remoteAuthenticationSettings =
            repository.getRemoteAuthenticationSettings();
        if (remoteAuthenticationSettings instanceof UsernamePasswordRemoteAuthenticationSettings) {
          final UsernamePasswordRemoteAuthenticationSettings upras =
              (UsernamePasswordRemoteAuthenticationSettings) remoteAuthenticationSettings;
          username = upras.getUsername();
          password = upras.getPassword();
        }

        try {
          artifactRepository.createProxyRepository(new URI(repository.getRemoteUrl()), username, password,
              artifactRepositoryDir.toURI(), artifactMappingsXmlFile);
View Full Code Here

        // not where originally was (just before the retrieve invocation on given test
        // does not change the test meaning.

        try {
          // remote target of repo2 is protected with HTTP BASIC
          UsernamePasswordRemoteAuthenticationSettings settings2 =
              new UsernamePasswordRemoteAuthenticationSettings("cstamas", "cstamas123");
          env.getRepositoryRegistry().getRepositoryWithFacet("repo2", ProxyRepository.class).getRemoteStorageContext()
              .setRemoteAuthenticationSettings(
                  settings2);
          // remote target of repo3 is protected with HTTP DIGEST
          UsernamePasswordRemoteAuthenticationSettings settings3 =
              new UsernamePasswordRemoteAuthenticationSettings("brian", "brian123");
          env.getRepositoryRegistry().getRepositoryWithFacet("repo3", ProxyRepository.class).getRemoteStorageContext()
              .setRemoteAuthenticationSettings(
                  settings3);
        }
        catch (NoSuchRepositoryException e) {
View Full Code Here

      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());
      }
    }
    else {
      return null;
    }
View Full Code Here

        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

    RemoteStorageContextCustomizer customizer = new RemoteStorageContextCustomizer(globalRemoteStorageContext);
    final Builder builder = testSubject.prepare(customizer);

    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

        String username = null;
        String password = null;
        final RemoteAuthenticationSettings remoteAuthenticationSettings =
            repository.getRemoteAuthenticationSettings();
        if (remoteAuthenticationSettings instanceof UsernamePasswordRemoteAuthenticationSettings) {
          final UsernamePasswordRemoteAuthenticationSettings upras =
              (UsernamePasswordRemoteAuthenticationSettings) remoteAuthenticationSettings;
          username = upras.getUsername();
          password = upras.getPassword();
        }

        try {
          metadataRepository.createProxyRepository(new URI(repository.getRemoteUrl()), username, password,
              metadataRepositoryDir.toURI());
View Full Code Here

    M2Repository m2Repo = (M2Repository) template.create();
    repoRegistry.addRepository(m2Repo);

    m2Repo.setRemoteUrl(remoteUrl);
    m2Repo.setRemoteAuthenticationSettings(new UsernamePasswordRemoteAuthenticationSettings("admin", "admin"));
    m2Repo.commitChanges();

    Reference rootRef = new Reference("http://localhost:8081/nexus/service/local/repositories/" + repoId + "");
    Reference resourceRef =
        new Reference(rootRef, "http://localhost:8081/nexus/service/local/repositories/" + repoId + "/");
View Full Code Here

TOP

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

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.