cache.put( key, credentials );
return credentials;
}
else
throw new CredentialsNotAvailableException( "Operation cancelled" );
}
else if( authscheme instanceof RFC2617Scheme )
{
if( hasCredentials() )
{
log.info( "Returning url credentials" );
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( getUsername(), pw );
cache.put( key, credentials );
return credentials;
}
log.info( host + ":" + port + " requires authentication with the realm '" + authscheme.getRealm() + "'" );
ShowDialog showDialog = new ShowDialog();
showDialog.values.put( "Info", "Authentication required for [" + host + ":" + port + "]" );
UISupport.getUIUtils().runInUIThreadIfSWT( showDialog );
if( showDialog.result )
{
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials( showDialog.values
.get( "Username" ), showDialog.values.get( "Password" ) );
cache.put( key, credentials );
return credentials;
}
else
throw new CredentialsNotAvailableException( "Operation cancelled" );
}
else
{
throw new CredentialsNotAvailableException( "Unsupported authentication scheme: "
+ authscheme.getSchemeName() );
}
}
catch( IOException e )
{
throw new CredentialsNotAvailableException( e.getMessage(), e );
}
}