private org.apache.maven.settings.Proxy getProxy( ArtifactRepository repository, List<org.apache.maven.settings.Proxy> proxies ) { if ( proxies != null && repository.getProtocol() != null ) { for ( org.apache.maven.settings.Proxy proxy : proxies ) { if ( proxy.isActive() && repository.getProtocol().equalsIgnoreCase( proxy.getProtocol() ) ) { if ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) ) { ProxyInfo pi = new ProxyInfo(); pi.setNonProxyHosts( proxy.getNonProxyHosts() ); org.apache.maven.wagon.repository.Repository repo = new org.apache.maven.wagon.repository.Repository( repository.getId(), repository.getUrl() ); if ( !ProxyUtils.validateNonProxyHosts( pi, repo.getHost() ) ) { return proxy; } } else { return proxy; } } } } return null; }
public String resolve(Repository repository){ return repository.getHost(); }
static String getBucketName(Repository repository) { return repository.getHost(); }
static String getBucketName(Repository repository) { return repository.getHost(); }
/** * Checks whtther provided url contains IPv6 format in host portion * * @return true if provide host part is of IPv6 format */ private boolean isIPv6Address() { return getHost().contains( ":" ); }
/** * Checks whtther provided url contains IPv6 format in host portion * * @return true if provide host part is of IPv6 format */ private boolean isIPv6Address() { return getHost().contains( ":" ); }
public String getUrl() { if ( url != null ) { return url; } StringBuilder sb = new StringBuilder(); sb.append( protocol ); sb.append( "://" ); if ( isIPv6Address() ) { // If this is IPv6 then we have to surround it // with brackets '[' and ']' sb.append( "[" ).append( getHost() ).append( "]" ); } else { sb.append( getHost() ); } if ( port != WagonConstants.UNKNOWN_PORT ) { sb.append( ":" ); sb.append( port ); } sb.append( basedir ); return sb.toString(); }
public String getUrl() { if ( url != null ) { return url; } StringBuilder sb = new StringBuilder(); sb.append( protocol ); sb.append( "://" ); if ( isIPv6Address() ) { // If this is IPv6 then we have to surround it // with brackets '[' and ']' sb.append( "[" ).append( getHost() ).append( "]" ); } else { sb.append( getHost() ); } if ( port != WagonConstants.UNKNOWN_PORT ) { sb.append( ":" ); sb.append( port ); } sb.append( basedir ); return sb.toString(); }
/** * @see SessionListener#sessionLoggedOff(SessionEvent) */ public void sessionLoggedOff(final SessionEvent sessionEvent) { sessionTracker.addSessionEvent(sessionEvent); sessionTracker.setLoggedOff(System.currentTimeMillis()); log.info("Logged off - " + sessionEvent.getWagon().getRepository().getHost()); }
/** * @see SessionListener#sessionLoggedIn(SessionEvent) */ public void sessionLoggedIn(final SessionEvent sessionEvent) { sessionTracker.addSessionEvent(sessionEvent); sessionTracker.setLoggedIn(System.currentTimeMillis()); log.info("Logged in - " + sessionEvent.getWagon().getRepository().getHost()); }
String host = repository.getHost(); String nonProxyHostsAsString = proxyInfo.getNonProxyHosts(); for (String nonProxyHost : StringUtils.split(nonProxyHostsAsString, ",;|")) {
/** * @return The hostname of the remote server prefixed with the username, which comes either from the repository URL * or from the authenticationInfo. */ private String buildRemoteHost() { String username = this.getRepository().getUsername(); if ( username == null ) { username = authenticationInfo.getUserName(); } if ( username == null ) { return getRepository().getHost(); } else { return username + "@" + getRepository().getHost(); } }
protected void openConnectionInternal() throws ConnectionException, AuthenticationException { final ProxyInfo proxyInfo = getProxyInfo( "http", getRepository().getHost() ); if ( proxyInfo != null ) { this.proxy = getProxy( proxyInfo ); this.proxyInfo = proxyInfo; } authenticator.setWagon( this ); boolean usePreemptiveAuthentication = Boolean.getBoolean( "maven.wagon.http.preemptiveAuthentication" ) || Boolean.parseBoolean( repository.getParameter( "preemptiveAuthentication" ) ) || this.preemptiveAuthentication; setPreemptiveAuthentication( usePreemptiveAuthentication ); }
public void openConnection() throws ConnectionException, AuthenticationException { previousHttpsProxyHost = System.getProperty("https.proxyHost"); previousHttpsProxyPort = System.getProperty("https.proxyPort"); previousHttpsProxyExclusions = System.getProperty("https.nonProxyHosts"); final ProxyInfo proxyInfo = getProxyInfo("https", getRepository().getHost()); if (proxyInfo != null) { setSystemProperty("https.proxyHost", proxyInfo.getHost()); setSystemProperty("https.proxyPort", String.valueOf(proxyInfo.getPort())); setSystemProperty("https.nonProxyHosts", proxyInfo.getNonProxyHosts()); } else { setSystemProperty("https.proxyHost", null); setSystemProperty("https.proxyPort", null); } super.openConnection(); }
@Override protected void connectToRepository(Repository source, AuthenticationInfo auth, ProxyInfo proxy) { AWSCredentials credentials = getCredentials(auth); this.client = getAmazonS3Client(credentials); this.transferManager = new TransferManager(credentials); this.bucketName = source.getHost(); validateBucket(client, bucketName); this.basedir = getBaseDir(source); // If they've specified <filePermissions> in settings.xml, that always wins CannedAccessControlList repoAcl = getAclFromRepository(source); if (repoAcl != null) { log.info("File permissions: " + repoAcl.name()); acl = repoAcl; } }
public void openConnection() throws ConnectionException, AuthenticationException { previousHttpsProxyHost = System.getProperty( "https.proxyHost" ); previousHttpsProxyPort = System.getProperty( "https.proxyPort" ); previousHttpsProxyExclusions = System.getProperty( "https.nonProxyHosts" ); final ProxyInfo proxyInfo = getProxyInfo( "https", getRepository().getHost() ); if ( proxyInfo != null ) { setSystemProperty( "https.proxyHost", proxyInfo.getHost() ); setSystemProperty( "https.proxyPort", String.valueOf( proxyInfo.getPort() ) ); setSystemProperty( "https.nonProxyHosts", proxyInfo.getNonProxyHosts() ); } else { setSystemProperty( "https.proxyHost", null ); setSystemProperty( "https.proxyPort", null ); } super.openConnection(); }
private int doMkCol( String url ) throws IOException { Repository repo = getRepository(); HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() ); AuthScope targetScope = getBasicAuthScope().getScope( targetHost ); if ( getCredentialsProvider().getCredentials( targetScope ) != null ) { BasicScheme targetAuth = new BasicScheme(); getAuthCache().put( targetHost, targetAuth ); } HttpMkcol method = new HttpMkcol( url ); try ( CloseableHttpResponse closeableHttpResponse = execute( method ) ) { return closeableHttpResponse.getStatusLine().getStatusCode(); } catch ( HttpException e ) { throw new IOException( e.getMessage(), e ); } finally { if ( method != null ) { method.releaseConnection(); } } }
private int doMkCol( String url ) throws IOException { Repository repo = getRepository(); HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() ); AuthScope targetScope = getBasicAuthScope().getScope( targetHost ); if ( getCredentialsProvider().getCredentials( targetScope ) != null ) { BasicScheme targetAuth = new BasicScheme(); getAuthCache().put( targetHost, targetAuth ); } HttpMkcol method = new HttpMkcol( url ); try ( CloseableHttpResponse closeableHttpResponse = execute( method ) ) { return closeableHttpResponse.getStatusLine().getStatusCode(); } catch ( HttpException e ) { throw new IOException( e.getMessage(), e ); } finally { if ( method != null ) { method.releaseConnection(); } } }