Package org.sonatype.nexus.rest.model

Examples of org.sonatype.nexus.rest.model.AuthenticationSettings


  public static AuthenticationSettings convert(RemoteAuthenticationSettings settings) {
    if (settings == null) {
      return null;
    }

    AuthenticationSettings auth = new AuthenticationSettings();

    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


  public static AuthenticationSettings convert(CRemoteAuthentication settings) {
    if (settings == null) {
      return null;
    }

    AuthenticationSettings auth = new AuthenticationSettings();

    auth.setUsername(settings.getUsername());

    auth.setPassword(PASSWORD_PLACE_HOLDER);

    auth.setNtlmHost(settings.getNtlmHost());

    auth.setNtlmDomain(settings.getNtlmDomain());

    // auth.setPrivateKey( settings.getPrivateKey() );

    // auth.setPassphrase( settings.getPassphrase() );
View Full Code Here

    Assert.assertEquals(RepositoryPolicy.RELEASE.name(), result.getRepoPolicy());
    Assert.assertEquals("proxy", result.getRepoType());

    Assert.assertEquals("http://foo.com/", result.getRemoteStorage().getRemoteStorageUrl());

    AuthenticationSettings resultAuth = result.getRemoteStorage().getAuthentication();

    Assert.assertEquals("ntlmDomain", resultAuth.getNtlmDomain());
    Assert.assertEquals("ntlmHost", resultAuth.getNtlmHost());
    // Assert.assertEquals( "passphrase", resultAuth.getPassphrase() );
    Assert.assertEquals(AbstractNexusPlexusResource.PASSWORD_PLACE_HOLDER, resultAuth.getPassword());
    // Assert.assertEquals( "privateKey", resultAuth.getPrivateKey() );
    Assert.assertEquals("username", resultAuth.getUsername());

    RemoteConnectionSettings resultCon = result.getRemoteStorage().getConnectionSettings();

    Assert.assertEquals(123, resultCon.getConnectionTimeout());
    Assert.assertEquals("queryString", resultCon.getQueryString());
View Full Code Here

    RepositoryProxyResource originalResource = this.sendAndGetResponse();

    originalResource.getRemoteStorage().setRemoteStorageUrl("http://foo-new.com");

    AuthenticationSettings authSettings = originalResource.getRemoteStorage().getAuthentication();
    authSettings.setNtlmDomain("ntlmDomain-new");
    authSettings.setNtlmHost("ntlmHost-new");
    authSettings.setPassword("password-new");
    authSettings.setUsername("username-new");

    RemoteConnectionSettings connectionSettings = originalResource.getRemoteStorage().getConnectionSettings();
    connectionSettings.setConnectionTimeout(1232);
    connectionSettings.setQueryString("queryString-new");
    connectionSettings.setRetrievalRetryCount(3212);
    connectionSettings.setUserAgentString("userAgentString-new");

    RepositoryPlexusResource plexusResource =
        (RepositoryPlexusResource) this.lookup(PlexusResource.class, RepositoryPlexusResource.class.getName());

    Request request = buildRequest();
    Response response = new Response(request);

    request.getAttributes().put(AbstractRepositoryPlexusResource.REPOSITORY_ID_KEY, originalResource.getId());

    RepositoryResourceResponse repoRequest = new RepositoryResourceResponse();
    repoRequest.setData(originalResource);

    RepositoryResourceResponse repoResponse =
        (RepositoryResourceResponse) plexusResource.put(null, request, response, repoRequest);
    RepositoryProxyResource result = (RepositoryProxyResource) repoResponse.getData();

    //
    // now check
    //

    Assert.assertEquals("test-id", result.getId());
    // Assert.assertEquals( true, result.isAllowWrite() );
    Assert.assertEquals(2, result.getArtifactMaxAge());
    Assert.assertEquals(true, result.isBrowseable());
    Assert.assertEquals(ChecksumPolicy.STRICT.name(), result.getChecksumPolicy());
    Assert.assertEquals(true, result.isDownloadRemoteIndexes());

    Assert.assertEquals(true, result.isExposed());
    Assert.assertEquals("maven2", result.getFormat());
    Assert.assertEquals(false, result.isIndexable());
    Assert.assertEquals(23, result.getMetadataMaxAge());
    Assert.assertEquals(Integer.valueOf(234), result.getItemMaxAge());
    Assert.assertEquals("test-name", result.getName());
    Assert.assertEquals(11, result.getNotFoundCacheTTL());
    Assert.assertEquals("maven2", result.getProvider());
    Assert.assertEquals(RepositoryPolicy.RELEASE.name(), result.getRepoPolicy());
    Assert.assertEquals("proxy", result.getRepoType());

    Assert.assertEquals("http://foo-new.com/", result.getRemoteStorage().getRemoteStorageUrl());

    AuthenticationSettings resultAuth = result.getRemoteStorage().getAuthentication();

    Assert.assertEquals("ntlmDomain-new", resultAuth.getNtlmDomain());
    Assert.assertEquals("ntlmHost-new", resultAuth.getNtlmHost());
    // Assert.assertEquals( "passphrase-new", resultAuth.getPassphrase() );
    Assert.assertEquals(AbstractNexusPlexusResource.PASSWORD_PLACE_HOLDER, resultAuth.getPassword());
    // Assert.assertEquals( "privateKey-new", resultAuth.getPrivateKey() );
    Assert.assertEquals("username-new", resultAuth.getUsername());

    RemoteConnectionSettings resultCon = result.getRemoteStorage().getConnectionSettings();

    Assert.assertEquals(1232, resultCon.getConnectionTimeout());
    Assert.assertEquals("queryString-new", resultCon.getQueryString());
View Full Code Here

    RepositoryResourceRemoteStorage remoteStorage = new RepositoryResourceRemoteStorage();
    repositoryResource.setRemoteStorage(remoteStorage);

    remoteStorage.setRemoteStorageUrl("http://foo.com");

    AuthenticationSettings authSettings = new AuthenticationSettings();
    remoteStorage.setAuthentication(authSettings);
    authSettings.setNtlmDomain("ntlmDomain");
    authSettings.setNtlmHost("ntlmHost");
    authSettings.setPassword("password");
    authSettings.setUsername("username");

    RemoteConnectionSettings connectionSettings = new RemoteConnectionSettings();
    remoteStorage.setConnectionSettings(connectionSettings);
    connectionSettings.setConnectionTimeout(123);
    connectionSettings.setQueryString("queryString");
View Full Code Here

    RepositoryResourceRemoteStorage remoteStorage = new RepositoryResourceRemoteStorage();
    repositoryResource.setRemoteStorage(remoteStorage);

    remoteStorage.setRemoteStorageUrl("http://foo.com");

    AuthenticationSettings authSettings = new AuthenticationSettings();
    remoteStorage.setAuthentication(authSettings);
    authSettings.setNtlmDomain("ntlmDomain");
    authSettings.setNtlmHost("ntlmHost");
    authSettings.setPassword("password");
    authSettings.setUsername("username");

    RepositoryListPlexusResource plexusResource =
        (RepositoryListPlexusResource) this.lookup(PlexusResource.class, RepositoryListPlexusResource.class.getName());

    Request request = buildRequest();
View Full Code Here

    repo.setProviderRole("providerRole");

    RepositoryResourceRemoteStorage remoteStorage = new RepositoryResourceRemoteStorage();
    remoteStorage.setRemoteStorageUrl("remoteStorageUrl");

    AuthenticationSettings auth = new AuthenticationSettings();
    auth.setNtlmDomain("ntlmdomain");
    auth.setNtlmHost("ntmlhost");
    auth.setPassword("password");
    auth.setUsername("username");

    remoteStorage.setAuthentication(auth);

    RemoteConnectionSettings connection = new RemoteConnectionSettings();
    connection.setConnectionTimeout(50);
View Full Code Here

    repo.setProviderRole("providerRole");

    RepositoryResourceRemoteStorage remoteStorage = new RepositoryResourceRemoteStorage();
    remoteStorage.setRemoteStorageUrl("remoteStorageUrl");

    AuthenticationSettings auth = new AuthenticationSettings();
    auth.setNtlmDomain("ntlmdomain");
    auth.setNtlmHost("ntmlhost");
    auth.setPassword("password");
    auth.setUsername("username");

    remoteStorage.setAuthentication(auth);

    RemoteConnectionSettings connection = new RemoteConnectionSettings();
    connection.setConnectionTimeout(50);
View Full Code Here

    resource.setGlobalConnectionSettings(connSet);

    RemoteHttpProxySettingsDTO proxyHttpSet = new RemoteHttpProxySettingsDTO();
    proxyHttpSet.setProxyHostname("proxyHostname1");
    proxyHttpSet.setProxyPort(78);
    AuthenticationSettings authSet = new AuthenticationSettings();
    authSet.setNtlmDomain("ntlmDomain1");
    authSet.setNtlmHost("ntlmHost1");
    authSet.setPassword("password1");
    authSet.setUsername("username1");
    proxyHttpSet.setAuthentication(authSet);

    RemoteHttpProxySettingsDTO proxyHttpsSet = new RemoteHttpProxySettingsDTO();
    proxyHttpsSet.setProxyHostname("proxyHostname2");
    proxyHttpsSet.setProxyPort(87);
    AuthenticationSettings httpsAuthSet = new AuthenticationSettings();
    httpsAuthSet.setNtlmDomain("ntlmDomain2");
    httpsAuthSet.setNtlmHost("ntlmHost2");
    httpsAuthSet.setPassword("password2");
    httpsAuthSet.setUsername("username2");
    proxyHttpsSet.setAuthentication(httpsAuthSet);

    RemoteProxySettingsDTO proxySet = new RemoteProxySettingsDTO();
    proxySet.setHttpProxySettings(proxyHttpSet);
    proxySet.setHttpsProxySettings(proxyHttpsSet);
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.rest.model.AuthenticationSettings

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.