Bug 295021 - User is pummeled with back-to-back password request dialogs when he brings up the update manager
Summary: User is pummeled with back-to-back password request dialogs when he brings up...
Status: CLOSED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 248787 (view as bug list)
Depends on:
Blocks: 248787
  Show dependency tree
 
Reported: 2009-11-12 17:02 EST by John Cortell CLA
Modified: 2011-05-30 13:47 EDT (History)
9 users (show)

See Also:


Attachments
dialog I'm being pummeled with (5.43 KB, image/gif)
2009-11-12 17:02 EST, John Cortell CLA
no flags Details
dialog I'm being pummeled with (6.33 KB, image/gif)
2009-11-12 17:05 EST, John Cortell CLA
no flags Details
Solution that alleviates the problem for me (7.17 KB, patch)
2009-11-13 12:35 EST, John Cortell CLA
no flags Details | Diff
Stack trace as described (2.97 KB, text/plain)
2009-11-16 19:49 EST, Henrich Kraemer CLA
no flags Details
Patch filtering out retries of SOCKS authentication errors (7.51 KB, patch)
2009-11-17 15:49 EST, Henrich Kraemer CLA
no flags Details | Diff
core.ui.net_v01 (3.61 KB, patch)
2010-03-30 09:24 EDT, Pawel Pogorzelski CLA
no flags Details | Diff
core.ui.net_v02 (1.76 KB, patch)
2010-03-30 10:38 EDT, Pawel Pogorzelski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Cortell CLA 2009-11-12 17:02:26 EST
Created attachment 152110 [details]
dialog I'm being pummeled with

I am getting 16 back-to-back dialogs asking for SOCKS authentication when I
bring up the update manager (see attached screenshot). For some reason the
password isn't taking, but that's irrelevant. Point is, whether I put in the
wrong userid/password, or I hit cancel, I get asked 15 more times...even if I
hit cancel in the dialog. After about the eight dialog, I was convinced that I
was caught in an infinite loop and that my only recourse was to hard-kill the
eclipse process via the Task Manager. But now I know better because I've dug
into the issue and I know there's a finite number of times I'll be asked.
Still, it might as well be infinite, because no sane user is going to keep
hitting cancel when there seems to be no end in sight.

How many update sites do I have? Only two. That's the scary thing. If I had 10,
I would be hit with 80 dialogs. Obviously, this is an unacceptable situation.

Why is the user being prompted eight time per update site?

a. The first problem is that CacheManager.createCache() initiates two http
requests. One for the jar, and when that fails, one for the xml. There is logic
to prevent a second iteration when there is a timeout, but what if the failure
is a (java.net.SocketException: SOCKS : authentication failed), as in my case.
There is no logic to prevent a retry in that case, and it seems to me there
should be. BTW, here are the two calls, each which result in an http request:
   -> lastModifiedRemote = getTransport().getLastModified(jarLocation,
submonitor.newChild(1));
   -> lastModifiedRemote = getTransport().getLastModified(xmlLocation,
submonitor.newChild(1));

b. for each attempt in (a), there will actually be four attempts, and that's
because by default an http request has a retry count of 3. To prevent that,
HttpClientFileSystemBrowser.runRequest() could override the retry behavior as
follows

   HttpMethodParams params = new HttpMethodParams();
   params.setParameter(HttpMethodParams.RETRY_HANDLER, 
       new DefaultHttpMethodRetryHandler() {
           public boolean retryMethod(
               final HttpMethod method, 
               final IOException exception, 
               int executionCount) {
                   return false;
               }
           }
       );
   headMethod.setParams(params);
Comment 1 John Cortell CLA 2009-11-12 17:05:11 EST
Created attachment 152115 [details]
dialog I'm being pummeled with
Comment 2 Susan McCourt CLA 2009-11-12 17:24:26 EST
what version are you running?
Comment 3 John Cortell CLA 2009-11-12 17:31:29 EST
I'm seeing identical behavior in both 3.6M3 and 3.5.1. I troubleshooted the problem with 3.6M3.
Comment 4 Henrik Lindberg CLA 2009-11-13 06:00:45 EST
I think this is for ECF.
Comment 5 Scott Lewis CLA 2009-11-13 10:26:02 EST
Adding Henrich Kraemer.

I'm not yet certain whether this behavior interacts with the p2 ui handling of file transfer cancellation, but it seems possible.
Comment 6 John Cortell CLA 2009-11-13 10:36:01 EST
(In reply to comment #5)
> Adding Henrich Kraemer.
> 
> I'm not yet certain whether this behavior interacts with the p2 ui handling of
> file transfer cancellation, but it seems possible.

There is no file transfer to cancel out of at that point. The code is merely trying to establish a connection to the update site. The user is prompted for his SOCKS user/password, and if he puts the wrong password or wants to cancel out altogether, he's going to be prompted 8X the number of update sites.
Comment 7 Scott Lewis CLA 2009-11-13 11:15:13 EST
(In reply to comment #6)
> (In reply to comment #5)
> > Adding Henrich Kraemer.
> > 
> > I'm not yet certain whether this behavior interacts with the p2 ui handling of
> > file transfer cancellation, but it seems possible.
> 
> There is no file transfer to cancel out of at that point. The code is merely
> trying to establish a connection to the update site. The user is prompted for
> his SOCKS user/password, and if he puts the wrong password or wants to cancel
> out altogether, he's going to be prompted 8X the number of update sites.

When I said 'file transfer cancellation', all I meant is the cancellation for the authentication step as you describe above.  This authentication is part of the ECF file transfer API (even though it's not the actual file transfer as you point out).
Comment 8 Henrich Kraemer CLA 2009-11-13 11:51:32 EST
If you have a stack trace handy to post that would help speedup investigation.

Thanks Henrich
Comment 9 John Cortell CLA 2009-11-13 12:32:53 EST
(In reply to comment #8)
> If you have a stack trace handy to post that would help speedup investigation.
> 
> Thanks Henrich

The situation is rather complex. A call stack won't get you very far. I can do better, though:

Reproducibility steps: 
*** Requires access to a SOCKS server. ***
1. Launch eclipse
2. Ensure you have at least one non-local update site configured in Windows > Preferences > General > Install/Update > Available Software Sites
3. In Windows > Preferences > General > Network Connections, set Active Provider to Manual and configure the proxy server description. Don't include the authentication information
4. Go to Help > Install New Software...
5. Authentication dialog seen in attached screenshot comes up.
6. Hit cancel
Dialog comes back up again and will do so seven more times. If you have two update sites, it will comes up 15 more times, etc.

I am also preparing a patch that has alleviated the problem for me.
Comment 10 John Cortell CLA 2009-11-13 12:35:57 EST
Created attachment 152175 [details]
Solution that alleviates the problem for me
Comment 11 Henrich Kraemer CLA 2009-11-13 18:54:01 EST
(In reply to comment #10)
> Created an attachment (id=152175) [details]
> Solution that alleviates the problem for me

Switching off HttpClient retries in general might have unwanted effects for
general robustness. 

I would like to see whether this can be done more selectively. At the moment I
am having unrelated trouble setting me up for reproducing this.

Thanks for the patch and repro steps.
Comment 12 Henrich Kraemer CLA 2009-11-16 17:13:33 EST
(In reply to comment #9)
..
> Reproducibility steps: 
> *** Requires access to a SOCKS server. ***
...
> 4. Go to Help > Install New Software...
> 5. Authentication dialog seen in attached screenshot comes up.
> 6. Hit cancel
> Dialog comes back up again and will do so seven more times. If you have two
> update sites, it will comes up 15 more times, etc.
> 
> I am also preparing a patch that has alleviated the problem for me.

I do not see the authentication dialog you are seeing. This is with Eclipse SDK 3.5.1.

Thoughts?
Comment 13 John Cortell CLA 2009-11-16 17:25:11 EST
(In reply to comment #12)
> (In reply to comment #9)
> ..
> > Reproducibility steps: 
> > *** Requires access to a SOCKS server. ***
> ...
> > 4. Go to Help > Install New Software...
> > 5. Authentication dialog seen in attached screenshot comes up.
> > 6. Hit cancel
> > Dialog comes back up again and will do so seven more times. If you have two
> > update sites, it will comes up 15 more times, etc.
> > 
> > I am also preparing a patch that has alleviated the problem for me.
> 
> I do not see the authentication dialog you are seeing. This is with Eclipse SDK
> 3.5.1.
> 
> Thoughts?

3.5.1 and 3.6(M3).

Strange. Try the following:
1. Only define a SOCKS proxy (no http, or https)
2. Make sure the definition is a 'manual' one (rather than 'native')
3. In the definition (in the global prefs), make sure you do not include the authentication info.

If after all that, you still do not get an authentication dialog when you go to Help > Install New Software..., we have quite a mystery.
Comment 14 Henrich Kraemer CLA 2009-11-16 19:48:25 EST
> Strange. Try the following:
> 1. Only define a SOCKS proxy (no http, or https)
> ..

Yes this makes a difference! After clearing manual credential data for http and https I can observe the issue.

With a BP on java.net.Authenticator.setDefault(Authenticator) one can see, that the default java.net.Authenticator (a static variable) is set initially to org.eclipse.ui.internal.net.auth.NetAuthenticator when 
org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.postStartup() executes:
 java.net.Authenticator.setDefault(java.net.Authenticator) line: 117	
 org.eclipse.core.internal.net.ProxyManager.registerAuthenticator() line: 384	
 org.eclipse.core.internal.net.ProxyManager.initialize() line: 283
 org.eclipse.core.internal.net.Activator.start(org.osgi.framework.BundleContext) line: 179	
 ...
 org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.activateProxyService() line: 258	
 org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.postStartup() line: 238	

I had already set the proxy preferences in a previous session.

So next I selecting menu item Help|Install New Software .. 

And observed that the socks proxy is filtered out because the type is not "SOCKS".
The type is derived from the URL scheme which is "http" for "http://download.eclipse.org/eclipse/updates/3.5/compositeContent.jar".
This happens in:
org.eclipse.core.internal.net.ProxyManager.getProxyDataForHost(java.lang.String, java.lang.String) line: 374	
 org.eclipse.core.internal.net.ProxyManager.select(java.net.URI) line: 560	
 org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientFileSystemBrowser(org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser).setupProxies() line: 245	
 org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientFileSystemBrowser.runRequest() line: 166	
 org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser$DirectoryJob.run(org.eclipse.core.runtime.IProgressMonitor) line: 71	


As a consequence no proxy server is selected as far as ECF is concerned. 
If a proxy was selected it seems that ultimately this would change the default authenticator to be set 
org.eclipse.ecf.provider.filetransfer.util.JREProxyHelper.setupProxy(Proxy).
It appears that this would be problematic as there can only be one Authenticator in the system. 
But the JRE URLConnection based ECF transfer providers seem to rely on this nonetheless. So perhaps this is the proper way it should work.

I assume however that unsetting the global net authenticator will have bad consequences. Is someone has better information, please let me know!

The code as written progresses to perform the browse operation resulting in the attached stack trace. As the NetAuthenticator does not have a cancel return value it return null as credentials. The SocksSocketImpl code at some point uses the system property 'user.name' and sends this without a password to the socks proxy serve, which fails the servers password check of course. As a consequence it throws:
throw new SocketException("SOCKS : authentication failed");
This is where the fact the user pressed cancel gets lost!

HttpClient currently repeats the request for 3 times as described. 

My best guess would be that ECF should have not filtered out the socks proxy.
In addition it should probably register its own authenticator which which is used only for the current ECF requests, possibly using thread local variables to make that decision.
If an authenticate call is made from a different context the original authenticator would be used. However there is no API to get the current Authenticator. 
This seems like quite a bit of work however. 

Perhaps someone on the proxy API team has a suggestion on how this could be properly implemented?
Comment 15 Henrich Kraemer CLA 2009-11-16 19:49:25 EST
Created attachment 152361 [details]
Stack trace as described
Comment 16 John Cortell CLA 2009-11-16 20:54:12 EST
(In reply to comment #14)
> My best guess would be that ECF should have not filtered out the socks proxy.

I agree. In fact, if you look at my fix for 295030, you'll see that what I do is use the SOCKS proxy regardless of the URL scheme if a SOCKS proxy has been configured. So, really, what you are observing here is why SOCKS support is just outright broken (295030)

> In addition it should probably register its own authenticator which which is
> used only for the current ECF requests, possibly using thread local variables
> to make that decision.
> If an authenticate call is made from a different context the original
> authenticator would be used. However there is no API to get the current
> Authenticator. 
> This seems like quite a bit of work however. 

Yeah. Mucking with the system-wide *default* authenticator seems like trouble. But I have to think there's probably a way to provide a custom authenticator for a particular operation. I'll dig into this some more and see if that makes sense.
Comment 17 John Cortell CLA 2009-11-16 21:33:23 EST
Henrich, I've dug into this some more and I'm not sure how providing a custom authenticator would help solve the problem. It's not only java.net.Authenticator that lacks the concept of the user wanting to cancel the operation; SocksSocketImpl is equally oblivious.

In other words, SocksSocketImpl calls into the authenticator by invoking Authenticator.requestPasswordAuthentication(). That simply returns a java.net.PasswordAuthentication object, which has no concept of a 'cancel'. Thus, you can register a custom authenticator that is able to detect and wants to inform its caller that the operation was canceled, but there's nothing in the caller (java.net.SocksSocketImpl#authenticate()) that will allow it do so do.

So it seems to me the only solution lies somewhere in the ability to provide a custom retry handler to the apache layer so that it doesn't keep prompting. This is what my solution does, but as you noted, it may not be targeted enough.
Comment 18 Henrich Kraemer CLA 2009-11-17 11:52:51 EST
(In reply to comment #17)

The eclipse authenticator could remember that user pressed cancel and provide API or provide a listener interface which provides this information.
This would allow ECF to determine to react to cancel properly.

Unless the proxy team suggests a different solution for handling cancellation I would think that there should be an RFE for this.

In the absence of this I think a focused switching off retries would give some relief and not cause harm.
However it is not a full solution as the ECF caller will not be aware of this an may retry itself.

The problem occurs even if one does provide the correct SOCKS credentials in the proxy dialogs (see comment 9, step 3)
Comment 19 John Cortell CLA 2009-11-17 12:12:56 EST
(In reply to comment #18)
> (In reply to comment #17)
> The eclipse authenticator could remember that user pressed cancel and provide
> API or provide a listener interface which provides this information.
> This would allow ECF to determine to react to cancel properly.

Hm. That sounds rather messy. Not sure there is an ideal solution here, but to be honest, that one sounds complicated and fragile to me.

> The problem occurs even if one does provide the correct SOCKS credentials in
> the proxy dialogs (see comment 9, step 3)

Again, that's bugzilla 295030. I've submitted a patch for that.
Comment 20 Henrich Kraemer CLA 2009-11-17 15:49:37 EST
Created attachment 152430 [details]
Patch filtering out retries of SOCKS authentication errors

The attached patch mitigates the issue, but does not solve it. 

The patch acts on the particular message of the SocketException which is certainly not API.
There is a chance that the bug would reemerge if the JRE implementation changed these strings. This appears quite unlikely to me however.
Comment 21 John Cortell CLA 2009-11-17 15:59:45 EST
Filtering on the exception string occurred to me, too, but it seemed far to fragile (way too much of a hack). Even if the strings don't change, you need to consider localization. Can we assume the exception string will always be in English?
Comment 22 John Cortell CLA 2009-11-17 16:21:25 EST
Also note that the retry handler only halves the number of dialogs thrown at the user. The other part of my proposed solution is to not try getting the update-site jar if getting the xml encountered a SocketException. This sort of logic already existed for timeout. I believe it should be extended for SocketExceptions as well (which would include the SOCKS authentication failure)
Comment 23 Steffen Pingel CLA 2009-11-17 16:41:51 EST
One approach that we have experimented with in Mylyn is to use thread local to pass request specific information down to a global callback. We store a request object and progress monitor before calling into a library which can then be retrieved when the callback is invoked and the socket can be closed for instance if the request is cancelled.

For the password prompt, wouldn't it make sense to only ever show one dialog at a time and block all other requests until the dialog has been dismissed?
Comment 24 John Cortell CLA 2009-11-17 16:49:24 EST
(In reply to comment #23)
> For the password prompt, wouldn't it make sense to only ever show one dialog at
> a time and block all other requests until the dialog has been dismissed?

In this scenario, only dialog *is* ever shown at a time. The "pummeling" happens sequentially.
Comment 25 John Cortell CLA 2009-11-17 16:54:49 EST
In this scenario, only ONE dialog *is* ever shown at a time
Comment 26 Henrich Kraemer CLA 2009-11-17 17:16:16 EST
(In reply to comment #21)
> Filtering on the exception string occurred to me, too, but it seemed far to
> fragile (way too much of a hack). Even if the strings don't change, you need to
> consider localization. Can we assume the exception string will always be in
> English?

Hi John,

When SocksSocketImpl throws SocketExceptions the strings are not localized. So it appears to me that one can rely on these messages being in English. This matches my experience with similar cases in another code base.

Still it is a hack. A solution not requiring this would probably be better. I would recommend the patch only if another solution does not present itself or nobody can be found to go through the effort of implementing that.
Comment 27 Henrich Kraemer CLA 2009-11-17 17:18:21 EST
(In reply to comment #23)
> One approach that we have experimented with in Mylyn is to use thread local to
> pass request specific information down to a global callback. We store a request
> object and progress monitor before calling into a library which can then be
> retrieved when the callback is invoked and the socket can be closed for
> instance if the request is cancelled.

Using thread locals can only solve the issue, but I think it will require changes in the proxy API.
Comment 28 John Cortell CLA 2009-11-17 17:33:03 EST
(In reply to comment #26)
> (In reply to comment #21)
> > Filtering on the exception string occurred to me, too, but it seemed far to
> > fragile (way too much of a hack). Even if the strings don't change, you need to
> > consider localization. Can we assume the exception string will always be in
> > English?
> 
> Hi John,
> 
> When SocksSocketImpl throws SocketExceptions the strings are not localized. So
> it appears to me that one can rely on these messages being in English. This
> matches my experience with similar cases in another code base.
> 
> Still it is a hack. A solution not requiring this would probably be better. I
> would recommend the patch only if another solution does not present itself or
> nobody can be found to go through the effort of implementing that.

Right. I saw that in the SocksSocketImpl. I'm just thinking that a future or
different version of the Java runtime might localize such strings (they should
be localized). 

But anyway, yes. I guess as a last resort, that will have to do. Having to hit
cancel on tens of dialogs is certainly much less acceptable :-/
Comment 29 Scott Lewis CLA 2009-11-17 17:34:53 EST
(In reply to comment #27)
> (In reply to comment #23)
> > One approach that we have experimented with in Mylyn is to use thread local to
> > pass request specific information down to a global callback. We store a request
> > object and progress monitor before calling into a library which can then be
> > retrieved when the callback is invoked and the socket can be closed for
> > instance if the request is cancelled.
> 
> Using thread locals can only solve the issue, but I think it will require
> changes in the proxy API.

Henrich and John:  Szymon and Pawel work on/with the proxy API and were
recently added to this bug at my request.  Would you please summarize (for
them) the issues here with the proxy API and socks support?...and for all of us
what you see as the options for addressing John's difficulties?  Thanks.
Comment 30 John Cortell CLA 2009-11-17 17:48:15 EST
(In reply to comment #29)
> (In reply to comment #27)
> > (In reply to comment #23)
> > > One approach that we have experimented with in Mylyn is to use thread local to
> > > pass request specific information down to a global callback. We store a request
> > > object and progress monitor before calling into a library which can then be
> > > retrieved when the callback is invoked and the socket can be closed for
> > > instance if the request is cancelled.
> > 
> > Using thread locals can only solve the issue, but I think it will require
> > changes in the proxy API.
> 
> Henrich and John:  Szymon and Pawel work on/with the proxy API and were
> recently added to this bug at my request.  Would you please summarize (for
> them) the issues here with the proxy API and socks support?...and for all of us
> what you see as the options for addressing John's difficulties?  Thanks.

Well, there's a lot of detail, but in brief 

1. SOCKS support simply doesn't work when used by ECF. But that's an ECF bug, not a proxy API one. That's a different bug 295030.

2. the user is hit with a ton of authentication dialogs when trying to cancel out of an ECF request when a SOCKS server is defined in Eclipse. The problem is ultimately a limitation in the java.net layer--it makes no distinction between a failed authentication attempt and a canceled one. Henrich thinks this may be solvable with a Proxy API change.

Please refer to the long series of posts for the missing detail, or ask questions if you need additional insight.
Comment 31 Henrich Kraemer CLA 2009-11-17 19:28:06 EST
My primary suggestions are in comment 18. 
This is based on the analysis in comment 14. The relevant portion regarding why I think the proxy team should weigh in here is

>.. As the NetAuthenticator does not have a cancel return
> value it return null as credentials. ..
> This is where the fact the user pressed cancel gets lost!

I think only the net authenticator can provide an API to get to the fact that user presses cancel.
But perhaps the proxy API team sees a different way to implement this.

Another possible mechanism to implemented this is suggested by Steffen in comment 23.
Comment 32 Pawel Pogorzelski CLA 2009-12-11 09:26:07 EST
(In reply to comment #31)
> My primary suggestions are in comment 18. 
> This is based on the analysis in comment 14. The relevant portion regarding why
> I think the proxy team should weigh in here is
> 
> >.. As the NetAuthenticator does not have a cancel return
> > value it return null as credentials. ..
> > This is where the fact the user pressed cancel gets lost!
> 
> I think only the net authenticator can provide an API to get to the fact that
> user presses cancel.
> But perhaps the proxy API team sees a different way to implement this.

NetAuthenticator does provide a return value for 'Cancel', it's simply a null value. The problem is that java.net doesn't handle this value appropriately.

> Another possible mechanism to implemented this is suggested by Steffen in
> comment 23.

What about throwing a specialized runtime exception from NetAuthenticator? I've checked it and it propagates down to HttpClientRetrieveFileTransfer which is ECF.
Comment 33 Henrich Kraemer CLA 2010-01-28 18:44:00 EST
> What about throwing a specialized runtime exception from NetAuthenticator? I've
> checked it and it propagates down to HttpClientRetrieveFileTransfer which is
> ECF.

That sounds feasible from an ECF perspective. 
Would core.net plugin be upversioned so that clients can adjust? 
Alternatively I would think one could enable this behavior using some other API perhaps utilizing thread locals.
Comment 34 Pawel Pogorzelski CLA 2010-02-01 10:02:00 EST
The version has already been bumped in 3.6 cycle.
Comment 35 John Cortell CLA 2010-02-24 12:54:04 EST
This is a serious problem and discussions seem to have stalled again...
Comment 36 Scott Lewis CLA 2010-02-24 13:11:42 EST
(In reply to comment #35)
> This is a serious problem and discussions seem to have stalled again...

Would someone that is familiar with what's going on (perhaps Pawel and/or Henrich ) please summarize where we are with this issue and bug 295030...so that next steps can be identified and accomplished?  It's not at all clear to me what is left to do to address this and/or bug 295030 in time for Helios, and if it's not clear to me it's probably not clear to others as well.
Comment 37 Henrich Kraemer CLA 2010-02-25 11:07:18 EST
(In reply to comment #36)
> Would someone that is familiar with what's going on (perhaps Pawel and/or
> Henrich ) 

Pawel, I was expecting you or someone on the core.net proxy service team to provide a cancel mechanism that ECF could leverage. Are you waiting for additional input?

- Henrich
Comment 38 Szymon Brandys CLA 2010-02-25 11:19:06 EST
Pawel will be available on Monday, then he will comment on it.
Comment 39 Pawel Pogorzelski CLA 2010-03-01 05:59:42 EST
Henrich, is the solution from comment 32 the way to go? If yes I'll implement the changes in the core.net project.
Comment 40 Henrich Kraemer CLA 2010-03-01 11:49:43 EST
(In reply to comment #39)
> Henrich, is the solution from comment 32 the way to go? If yes I'll implement
> the changes in the core.net project.

It appears this solution should work.
Comment 41 John Cortell CLA 2010-03-29 11:01:31 EDT
This issue seems to have stalled again.
Comment 42 Pawel Pogorzelski CLA 2010-03-30 09:24:45 EDT
Created attachment 163407 [details]
core.ui.net_v01

A patch making OperationCanceledException is thrown after user cancels the dialog. While it makes easy for ECF to provide a fix it impacts other code leveraging the authenticator.

I'll investigate using thread local variables, like Henrich suggested. Hope the same result can be achieved not impacting other clients.
Comment 43 Pawel Pogorzelski CLA 2010-03-30 10:38:51 EDT
Created attachment 163412 [details]
core.ui.net_v02

Henrich, this is a solution with thread local variable. I haven't tested it though. Since it doesn't break clients I prefer this one.
Comment 44 Henrich Kraemer CLA 2010-03-31 00:10:50 EDT
(In reply to comment #43)
> Henrich, this is a solution with thread local variable. I haven't tested it
> though. Since it doesn't break clients I prefer this one.

I am not sure how I would access the static method from within ECF. Perhaps it can be made available by the core net plugin perhaps via some addition to IProxyService?
Comment 45 Pawel Pogorzelski CLA 2010-03-31 04:25:44 EDT
(In reply to comment #44)

You have to add the package to Import-package in the manifest file. The package is internal but is being exported from the bundle.

Since API is frozen and it's a plain hack we are not likely to publish it as an API, at least not in 3.6. For now I can comment the code so it's not changed by accident.
Comment 46 Henrich Kraemer CLA 2010-04-02 00:25:54 EDT
(In reply to comment #45)
> (In reply to comment #44)
> 
> You have to add the package to Import-package in the manifest file. The package
> is internal but is being exported from the bundle.
> 
> Since API is frozen and it's a plain hack we are not likely to publish it as an
> API, at least not in 3.6. For now I can comment the code so it's not changed by
> accident.

Take note of https://bugs.eclipse.org/bugs/show_bug.cgi?id=295030#c61
In particular the insight that "In the current state of the eclipse net authenticator (org.eclipse.ui.internal.net.auth.NetAuthenticator) is not usable as it prompts users repeatedly even if users provided the correct credentials to the prompt dialog or prior in the preference page."

Therefore the plan at the moment is to have ECF set its own Authenticator which means that both proposed patches will not be needed.  

The linked comment also mentions that the net API should probably evolve to handle the central Authenticator and manage the credentials.
Comment 47 Steffen Pingel CLA 2010-07-08 19:59:33 EDT
*** Bug 248787 has been marked as a duplicate of this bug. ***
Comment 48 Pascal Rapicault CLA 2011-05-30 13:47:32 EDT
I believe this got addressed in 3.6 as changes got done in p2 to serialize pwd prompting. if the pb still occurs please reopen or open a new bug. Thx.