private String getRepoKey( RemoteRepository repository ) { StringBuilder buffer = new StringBuilder( 128 ); Proxy proxy = repository.getProxy(); if ( proxy != null ) { appendAuth( buffer, proxy.getAuthentication() ); buffer.append( proxy.getHost() ).append( ':' ).append( proxy.getPort() ).append( '>' ); } Authentication auth = repository.getAuthentication(); appendAuth( buffer, auth ); buffer.append( repository.getContentType() ).append( '-' ); buffer.append( normalizeRepoUrl( repository.getUrl() ) ); return buffer.toString(); }
/** * Creates a new proxy with the specified properties. * @param proxy The proxy object. */ public RepositoryProxy(final Proxy proxy) { this.type = proxy.getType(); this.host = proxy.getHost(); this.port = proxy.getPort(); this.auth = new RepositoryAuthentication(proxy.getAuthentication()); }
/** * Sets the authentication to use for the proxy connection. * * @param auth The authentication to use, may be {@code null}. * @return The new proxy, never {@code null}. */ public Proxy setAuthentication( Authentication auth ) { if ( eq( this.auth, auth ) ) { return this; } return new Proxy( type, host, port, auth ); }
@Override public RemoteRepository decorate(RemoteRepository repo) { loadBeesConfig(); if (proxyHost != null && proxyPort!=null) { String proxyType = Proxy.TYPE_HTTP; if (repo.getUrl().startsWith("https")) proxyType = Proxy.TYPE_HTTPS; Proxy proxy = new Proxy(proxyType, proxyHost, Integer.parseInt(proxyPort), null); if (proxyUser != null) { Authentication authentication = new Authentication(proxyUser, proxyPass); proxy.setAuthentication(authentication); } repo.setProxy(proxy); } return repo; }
String key = proxy.proxy.getType().toLowerCase( Locale.ENGLISH ); if ( !candidates.containsKey( key ) )
private String getRepoKey( RemoteRepository repository ) { StringBuilder buffer = new StringBuilder( 128 ); Proxy proxy = repository.getProxy(); if ( proxy != null ) { appendAuth( buffer, proxy.getAuthentication() ); buffer.append( proxy.getHost() ).append( ':' ).append( proxy.getPort() ).append( '>' ); } Authentication auth = repository.getAuthentication(); appendAuth( buffer, auth ); buffer.append( repository.getContentType() ).append( '-' ); buffer.append( normalizeRepoUrl( repository.getUrl() ) ); return buffer.toString(); }
private ProxyInfoProvider getProxy( RemoteRepository repository ) { ProxyInfoProvider proxy = null; Proxy p = repository.getProxy(); if ( p != null ) { final ProxyInfo prox = new ProxyInfo(); prox.setType( p.getType() ); prox.setHost( p.getHost() ); prox.setPort( p.getPort() ); if ( p.getAuthentication() != null ) { prox.setUserName( p.getAuthentication().getUsername() ); prox.setPassword( p.getAuthentication().getPassword() ); } proxy = new ProxyInfoProvider() { public ProxyInfo getProxyInfo( String protocol ) { return prox; } }; } return proxy; }
/** * Sets the authentication to use for the proxy connection. * * @param auth The authentication to use, may be {@code null}. * @return The new proxy, never {@code null}. */ public Proxy setAuthentication( Authentication auth ) { if ( eq( this.auth, auth ) ) { return this; } return new Proxy( type, host, port, auth ); }
@Override public RemoteRepository decorate(RemoteRepository repo) { try { BeesClientConfiguration bcc = bees.get().getBeesClientConfiguration(); if (bcc==null) return repo; if (bcc.getProxyHost() != null && bcc.getProxyPort() > 0) { String proxyType = Proxy.TYPE_HTTP; if (repo.getUrl().startsWith("https")) proxyType = Proxy.TYPE_HTTPS; Proxy proxy = new Proxy(proxyType, bcc.getProxyHost(), bcc.getProxyPort(), null); if (bcc.getProxyUser() != null) { Authentication authentication = new Authentication(bcc.getProxyUser(), bcc.getProxyPassword()); proxy.setAuthentication(authentication); } repo.setProxy(proxy); } return repo; } catch (IOException e) { throw (Error)new Error("Failed to configure remote repository").initCause(e); } } }
public void setProxy(URL proxyUrl, String proxyUser, String proxyPassword) { Authentication auth = new Authentication(proxyUser, proxyPassword); Proxy proxy = new Proxy(proxyUrl.getProtocol(), proxyUrl.getHost(), proxyUrl.getPort(), auth); synchronized (repos) { for (RemoteRepository repo : repos) { repo.setProxy(proxy); } } }
private ProxyServer getProxy( RemoteRepository repository, String credentialEncoding ) { ProxyServer proxyServer = null; Proxy p = repository.getProxy(); if ( p != null ) { Authentication a = p.getAuthentication(); boolean useSSL = repository.getProtocol().equalsIgnoreCase( "https" ) || repository.getProtocol().equalsIgnoreCase( "dav:https" ); if ( a == null ) { proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort() ); } else { proxyServer = new ProxyServer( useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort(), a.getUsername(), a.getPassword() ); proxyServer.setEncoding( credentialEncoding ); } } return proxyServer; }
/** * Sets the authentication to use for the proxy connection. * * @param auth The authentication to use, may be {@code null}. * @return The new proxy, never {@code null}. */ public Proxy setAuthentication( Authentication auth ) { if ( eq( this.auth, auth ) ) { return this; } return new Proxy( type, host, port, auth ); }
/** * Sets the port number for the proxy. * * @param port The port number for the proxy. * @return The new proxy, never {@code null}. */ public Proxy setPort( int port ) { if ( this.port == port ) { return this; } return new Proxy( type, host, port, auth ); }