Package org.sonatype.aether.repository

Examples of org.sonatype.aether.repository.Authentication


   public static org.sonatype.aether.repository.Proxy convertFromMavenProxy(org.apache.maven.settings.Proxy proxy)
   {
      org.sonatype.aether.repository.Proxy result = null;
      if (proxy != null)
      {
         Authentication auth = new Authentication(proxy.getUsername(), proxy.getPassword());
         result = new org.sonatype.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
      }
      return result;
   }
View Full Code Here


        resolverSettings.setUseMavenCentral(true);
        List<RemoteRepository> repos = resolverSettings.getRemoteRepositories();
        for (RemoteRepository remoteRepository : repos) {
            Server server = resolverSettings.getSettings().getServer(remoteRepository.getId());
            if (server != null) {
                remoteRepository.setAuthentication(new Authentication(server.getUsername(), server.getPassword(), server.getPrivateKey(), server.getPassphrase()));
            }
            repositories.add(decorate(remoteRepository, decorators));
        }
        RemoteRepository r = new RemoteRepository("cloudbees-public-release", "default", "https://repository-cloudbees.forge.cloudbees.com/public-release/");
        repositories.add(decorate(r,decorators));
View Full Code Here

   public static org.sonatype.aether.repository.Proxy convertFromMavenProxy(org.apache.maven.settings.Proxy proxy)
   {
      org.sonatype.aether.repository.Proxy result = null;
      if (proxy != null)
      {
         Authentication auth = new Authentication(proxy.getUsername(), proxy.getPassword());
         result = new org.sonatype.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
      }
      return result;
   }
View Full Code Here

    private static Collection<String> reps(
        final Collection<RemoteRepository> repos) {
        final Collection<String> texts = new ArrayList<String>(repos.size());
        final StringBuilder text = new StringBuilder();
        for (RemoteRepository repo : repos) {
            final Authentication auth = repo.getAuthentication();
            text.setLength(0);
            text.append(repo.toString());
            if (auth == null) {
                text.append(" without authentication");
            } else {
                text.append(" with ").append(auth.toString());
            }
            texts.add(text.toString());
        }
        return texts;
    }
View Full Code Here

        if (password == null) {
            throw new IllegalArgumentException("Missing 'password' in file: " + REPO_FILE);
        }
        log.debug("Using user {} to access repo.fusesource.com", username);

        return new Authentication(username, password);
    }
View Full Code Here

     */
    static RemoteRepository createRemoteRepository(String repositoryUrl) {
        String id;
        RemoteRepository remoteRepository = null;
        repositoryUrl = repositoryUrl.trim();
        Authentication authentication = getAuthentication(repositoryUrl);
        if (authentication != null) {
            repositoryUrl = repositoryUrl.replaceFirst(String.format("%s:%s@", authentication.getUsername(), authentication.getPassword()), "");
        }

        Matcher idMatcher = REPOSITORY_ID_REGEX.matcher(repositoryUrl);
        if (idMatcher.matches()) {
            id = idMatcher.group(2);
View Full Code Here

     * Get the {@link Authentication} instance if the URL contains credentials, otherwise return null.
     * @param repositoryUrl
     * @return
     */
     static Authentication getAuthentication(String repositoryUrl) {
        Authentication authentication = null;
        try {
            URL url = new URL(repositoryUrl);
            String authority = url.getUserInfo();
            if (!Strings.isNullOrEmpty(authority)) {
                String[] parts = authority.split(":");
                if (parts.length == 2) {
                    authentication = new Authentication(parts[0], parts[1]);
                }
            }
        } catch (MalformedURLException e) {
            LOGGER.warning("{} does not look like a valid repository URL");
        }
View Full Code Here

        List<RemoteRepository> repos = new ArrayList<RemoteRepository>();
        for( int i = 0; i < repositories.length; i++ ) {
            String text = repositories[i].trim();
           
            //let's first extract authentication information
            Authentication authentication = getAuthentication(text);
            if (authentication != null) {
                text = text.replaceFirst(String.format("%s:%s@", authentication.getUsername(), authentication.getPassword()), "");
            }
           
            boolean snapshot = false;
            while (true) {
                int idx = text.lastIndexOf('@');
View Full Code Here

    /*
     * Get the {@link Authentication} instance if the URL contains credentials, otherwise return null
     */
    private Authentication getAuthentication(String text) {
        Authentication authentication = null;
        try {
            URL url = new URL(text);
            String authority = url.getUserInfo();
            if (Strings.notEmpty(authority)) {
                String[] parts = authority.split(":");
                if (parts.length == 2) {
                    authentication = new Authentication(parts[0], parts[1]);
                }
            }
        } catch (MalformedURLException e) {
            LOGGER.warn("{} does not look like a valid repository URL");
        }
View Full Code Here

        List<RemoteRepository> repos = resolverSettings.getRemoteRepositories();
        for (RemoteRepository remoteRepository : repos) {
            Server server = resolverSettings.getSettings().getServer(remoteRepository.getId());
            if (server != null) {
                server = decrypter.decrypt(new DefaultSettingsDecryptionRequest(server)).getServer();
                remoteRepository.setAuthentication(new Authentication(server.getUsername(), server.getPassword(), server.getPrivateKey(), server.getPassphrase()));
            }
            repositories.add(decorate(remoteRepository, decorators));
        }
        RemoteRepository r = new RemoteRepository("cloudbees-public-release", "default", "https://repository-cloudbees.forge.cloudbees.com/public-release/");
        repositories.add(decorate(r,decorators));
View Full Code Here

TOP

Related Classes of org.sonatype.aether.repository.Authentication

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.