(UsernamePasswordRemoteAuthenticationSettings) ras; getLogger().info( "... {} authentication setup for remote storage with username '{}'", authScope, uras.getUsername() ); credentials = new UsernamePasswordCredentials( uras.getUsername(), uras.getPassword() );
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); } }
&& UsernamePasswordRemoteAuthenticationSettings.class.isAssignableFrom( authentication.getClass() ) ) username = ( (UsernamePasswordRemoteAuthenticationSettings) authentication ).getUsername(); password = ( (UsernamePasswordRemoteAuthenticationSettings) authentication ).getPassword();
final UsernamePasswordRemoteAuthenticationSettings upras = (UsernamePasswordRemoteAuthenticationSettings) remoteAuthenticationSettings; username = upras.getUsername(); password = upras.getPassword();
final UsernamePasswordRemoteAuthenticationSettings upras = (UsernamePasswordRemoteAuthenticationSettings) remoteAuthenticationSettings; username = upras.getUsername(); password = upras.getPassword();
uras.getUsername() ); new UsernamePasswordCredentials( uras.getUsername(), uras.getPassword() ) ); uras.getUsername() ); new UsernamePasswordCredentials( uras.getUsername(), uras.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; }
auth.setUsername( up.getUsername() );
(UsernamePasswordRemoteAuthenticationSettings) settings; remoteAuthentication.setUsername( up.getUsername() );
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() );