@Override protected void copyTransients( Object source, Object destination ) { super.copyTransients( source, destination ); // we need to manually set the authentication to null here, because of flawed overlay, where null objects do NOT // overwrite non-null objects if ( ( (CRemoteHttpProxySettings) source ).getAuthentication() == null ) { ( (CRemoteHttpProxySettings) destination ).setAuthentication( null ); } } }
public RemoteAuthenticationSettings getProxyAuthentication() { if ( isEnabled() ) { try { return authenticationInfoConverter.convertAndValidateFromModel( getCurrentConfiguration( false ) .getAuthentication() ); } catch ( ConfigurationException e ) { // FIXME: what here?? setProxyAuthentication( null ); return null; } } return null; }
/** * Externalized Nexus object to DTO's conversion. */ public static RemoteHttpProxySettingsDTO convert(CRemoteHttpProxySettings settings) { if (settings == null) { return null; } final RemoteHttpProxySettingsDTO result = new RemoteHttpProxySettingsDTO(); result.setProxyHostname(settings.getProxyHostname()); result.setProxyPort(settings.getProxyPort()); result.setAuthentication(convert(settings.getAuthentication())); return result; }
public ValidationResponse validateRemoteHttpProxySettings( ApplicationValidationContext ctx, CRemoteHttpProxySettings settings ) { ValidationResponse response = new ApplicationValidationResponse(); if ( ctx != null ) { response.setContext( ctx ); } if ( settings.getProxyPort() < 1 || settings.getProxyPort() > 65535 ) { response.addValidationError( "The proxy port must be an integer between 1 and 65535!" ); } response.append( validateRemoteAuthentication( ctx, settings.getAuthentication() ) ); return response; }
/** * Method writeCRemoteHttpProxySettings. * * @param cRemoteHttpProxySettings * @param serializer * @param tagName * @throws java.io.IOException */ private void writeCRemoteHttpProxySettings( CRemoteHttpProxySettings cRemoteHttpProxySettings, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( cRemoteHttpProxySettings.getProxyHostname() != null ) { serializer.startTag( NAMESPACE, "proxyHostname" ).text( cRemoteHttpProxySettings.getProxyHostname() ).endTag( NAMESPACE, "proxyHostname" ); } if ( cRemoteHttpProxySettings.getProxyPort() != 0 ) { serializer.startTag( NAMESPACE, "proxyPort" ).text( String.valueOf( cRemoteHttpProxySettings.getProxyPort() ) ).endTag( NAMESPACE, "proxyPort" ); } if ( cRemoteHttpProxySettings.getAuthentication() != null ) { writeCRemoteAuthentication( (CRemoteAuthentication) cRemoteHttpProxySettings.getAuthentication(), "authentication", serializer ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeCRemoteHttpProxySettings( CRemoteHttpProxySettings, String, XmlSerializer )
&& config.getGlobalHttpProxySettings().getAuthentication() != null && StringUtils.isNotEmpty( config.getGlobalHttpProxySettings().getAuthentication().getPassword() ) ) CRemoteAuthentication auth = config.getGlobalHttpProxySettings().getAuthentication(); auth.setPassword( encryptDecryptPassword( auth.getPassword(), encrypt, mask ) ); && repo.getRemoteStorage().getHttpProxySettings().getAuthentication() != null && StringUtils.isNotEmpty( repo.getRemoteStorage().getHttpProxySettings().getAuthentication().getPassword() ) ) CRemoteAuthentication auth = repo.getRemoteStorage().getHttpProxySettings().getAuthentication(); auth.setPassword( encryptDecryptPassword( auth.getPassword(), encrypt, mask ) );
/** * Externalized Nexus object to DTO's conversion. * * @param resource */ public static RemoteHttpProxySettings convert( CRemoteHttpProxySettings settings ) { if ( settings == null ) { return null; } RemoteHttpProxySettings result = new RemoteHttpProxySettings(); result.setProxyHostname( settings.getProxyHostname() ); result.setProxyPort( settings.getProxyPort() ); result.setAuthentication( convert( settings.getAuthentication() ) ); result.setNonProxyHosts( settings.getNonProxyHosts() ); return result; }
public RemoteProxySettings convertAndValidateFromModel( CRemoteHttpProxySettings model ) throws ConfigurationException { ( (CGlobalHttpProxySettingsCoreConfiguration) getCurrentCoreConfiguration() ).doValidateChanges( model ); if ( model != null ) { RemoteProxySettings remoteProxySettings = new DefaultRemoteProxySettings(); remoteProxySettings.setBlockInheritance( model.isBlockInheritance() ); if ( remoteProxySettings.isBlockInheritance() ) { return remoteProxySettings; } remoteProxySettings.setHostname( model.getProxyHostname() ); remoteProxySettings.setPort( model.getProxyPort() ); remoteProxySettings.setProxyAuthentication( authenticationInfoConverter.convertAndValidateFromModel( model .getAuthentication() ) ); remoteProxySettings.setNonProxyHosts( new HashSet<String>( model.getNonProxyHosts() ) ); return remoteProxySettings; } else { return null; } }