protected void inspect(final Event<?> evt) { // FIXME: Sort out what to do with http/https here RemoteHttpProxySettings httpProxySettings = globalRemoteProxySettings.getHttpProxySettings(); if (httpProxySettings != null && httpProxySettings.isEnabled()) { String username = null; String password = null; final RemoteAuthenticationSettings authentication = httpProxySettings.getProxyAuthentication(); if (authentication != null && UsernamePasswordRemoteAuthenticationSettings.class.isAssignableFrom(authentication.getClass())) { username = ((UsernamePasswordRemoteAuthenticationSettings) authentication).getUsername(); password = ((UsernamePasswordRemoteAuthenticationSettings) authentication).getPassword(); } final String hostname = httpProxySettings.getHostname(); final int port = httpProxySettings.getPort(); final Set<String> nonProxyHosts = globalRemoteProxySettings.getNonProxyHosts(); log.debug( "Configure P2 proxy using global http proxy settings: hostname={}, port={}, username={}, nonProxyHosts={}", hostname, port, username, nonProxyHosts ); httpProxy.setProxySettings(hostname, port, username, password, nonProxyHosts); } else { log.debug("No global http proxy settings. Resetting P2 proxy."); httpProxy.setProxySettings(null, -1, null, null, null); } }
oldHttpProxyPassword = ((UsernamePasswordRemoteAuthenticationSettings) remoteProxySettingsConfiguration.getHttpProxySettings() .getProxyAuthentication()).getPassword(); oldHttpsProxyPassword = ((UsernamePasswordRemoteAuthenticationSettings) remoteProxySettingsConfiguration.getHttpsProxySettings() .getProxyAuthentication()).getPassword();
/** * Externalized Nexus object to DTO's conversion. */ 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; }
public RemoteAuthenticationSettings convertAndValidateFromModel( CRemoteAuthentication model ) throws ConfigurationException { if ( model != null ) { doValidate( model ); if ( StringUtils.isNotBlank( model.getKeyStore() ) || StringUtils.isNotBlank( model.getTrustStore() ) ) { return new ClientSSLRemoteAuthenticationSettings( new File( model.getTrustStore() ), model .getTrustStorePassword(), new File( model.getKeyStore() ), model.getKeyStorePassword() ); } 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; } }
oldPasswordForRemoteStorage = ((UsernamePasswordRemoteAuthenticationSettings) proxyRepo .getRemoteAuthenticationSettings()).getPassword();
auth.setUsername( up.getUsername() );
(UsernamePasswordRemoteAuthenticationSettings) ras; getLogger().info( "... {} authentication setup for remote storage with username '{}'", authScope, uras.getUsername() ); credentials = new UsernamePasswordCredentials( uras.getUsername(), uras.getPassword() );
( (UsernamePasswordRemoteAuthenticationSettings) getGlobalHttpProxySettings().getProxyAuthentication() ).getPassword();
&& UsernamePasswordRemoteAuthenticationSettings.class.isAssignableFrom( authentication.getClass() ) ) username = ( (UsernamePasswordRemoteAuthenticationSettings) authentication ).getUsername(); password = ( (UsernamePasswordRemoteAuthenticationSettings) authentication ).getPassword();
.getRemoteAuthenticationSettings() ).getPassword(); .getProxyAuthentication() ).getPassword();
final UsernamePasswordRemoteAuthenticationSettings upras = (UsernamePasswordRemoteAuthenticationSettings) remoteAuthenticationSettings; username = upras.getUsername(); password = upras.getPassword();
final UsernamePasswordRemoteAuthenticationSettings upras = (UsernamePasswordRemoteAuthenticationSettings) remoteAuthenticationSettings; username = upras.getUsername(); password = upras.getPassword();
(UsernamePasswordRemoteAuthenticationSettings) settings; remoteAuthentication.setUsername( up.getUsername() ); remoteAuthentication.setPassword( up.getPassword() );
uras.getUsername() ); new UsernamePasswordCredentials( uras.getUsername(), uras.getPassword() ) ); uras.getUsername() ); new UsernamePasswordCredentials( uras.getUsername(), uras.getPassword() ) );
new Realm.RealmBuilder().setPrincipal( uras.getUsername() ).setPassword( uras.getPassword() ).setUsePreemptiveAuth( true ).build(); (UsernamePasswordRemoteAuthenticationSettings) ras; proxy = new ProxyServer( rps.getHostname(), rps.getPort(), uras.getUsername(), uras.getPassword() );