[
https://issues.jboss.org/browse/JBIDE-12999?page=com.atlassian.jira.plugi...
]
Andre Dietisheim edited comment on JBIDE-12999 at 11/6/12 4:00 PM:
-------------------------------------------------------------------
Egit uses it's own Authenticator that overrides the NetAuthenticator installed by
org.eclipse.ui. This Authenticator does not pop up a auth dialog, it tries to get the
proxy-credentials from preferences (IProxyData):
{code:title=org.eclipse.egit.ui.EclipseAuthenticator}
class EclipseAuthenticator extends Authenticator {
private final IProxyService service;
EclipseAuthenticator(final IProxyService s) {
service = s;
}
@Override
protected PasswordAuthentication getPasswordAuthentication() {
final IProxyData[] data = service.getProxyData();
if (data == null)
return null;
for (final IProxyData d : data) {
if (d.getUserId() == null || d.getHost() == null)
continue;
if (d.getPort() == getRequestingPort() && hostMatches(d))
return auth(d);
}
return null;
}
private PasswordAuthentication auth(final IProxyData d) {
final String user = d.getUserId();
final String pass = d.getPassword();
final char[] passChar = pass != null ? pass.toCharArray() : new char[0];
return new PasswordAuthentication(user, passChar);
}
private boolean hostMatches(final IProxyData d) {
try {
final InetAddress dHost = InetAddress.getByName(d.getHost());
InetAddress rHost = getRequestingSite();
if (rHost == null)
rHost = InetAddress.getByName(getRequestingHost());
return dHost.equals(rHost);
} catch (UnknownHostException err) {
return false;
}
}
}
{code}
It registers it when the EGit UI plugin gets activated:
{code:title=org.eclipse.egit.ui.Activator}
private void setupProxy(final BundleContext context) {
final ServiceReference proxy;
proxy = context.getServiceReference(IProxyService.class.getName());
if (proxy != null) {
ProxySelector.setDefault(new EclipseProxySelector(
(IProxyService) context.getService(proxy)));
Authenticator.setDefault(new EclipseAuthenticator(
(IProxyService) context.getService(proxy)));
}
}
{code}
Since we're using EGit it could be simply enough to ensure EGit UI plugin is started.
was (Author: adietish):
Egit uses it's own Authenticator that does not pop up a auth dialog. It tries to
get the proxy-credentials from preferences (IProxyData:
{code:title=org.eclipse.egit.ui.EclipseAuthenticator}
class EclipseAuthenticator extends Authenticator {
private final IProxyService service;
EclipseAuthenticator(final IProxyService s) {
service = s;
}
@Override
protected PasswordAuthentication getPasswordAuthentication() {
final IProxyData[] data = service.getProxyData();
if (data == null)
return null;
for (final IProxyData d : data) {
if (d.getUserId() == null || d.getHost() == null)
continue;
if (d.getPort() == getRequestingPort() && hostMatches(d))
return auth(d);
}
return null;
}
private PasswordAuthentication auth(final IProxyData d) {
final String user = d.getUserId();
final String pass = d.getPassword();
final char[] passChar = pass != null ? pass.toCharArray() : new char[0];
return new PasswordAuthentication(user, passChar);
}
private boolean hostMatches(final IProxyData d) {
try {
final InetAddress dHost = InetAddress.getByName(d.getHost());
InetAddress rHost = getRequestingSite();
if (rHost == null)
rHost = InetAddress.getByName(getRequestingHost());
return dHost.equals(rHost);
} catch (UnknownHostException err) {
return false;
}
}
}
{code}
It registers it when the EGit UI plugin gets activated:
{code:title=org.eclipse.egit.ui.Activator}
private void setupProxy(final BundleContext context) {
final ServiceReference proxy;
proxy = context.getServiceReference(IProxyService.class.getName());
if (proxy != null) {
ProxySelector.setDefault(new EclipseProxySelector(
(IProxyService) context.getService(proxy)));
Authenticator.setDefault(new EclipseAuthenticator(
(IProxyService) context.getService(proxy)));
}
}
{code}
Since we're using EGit it could be simply enough to ensure EGit UI plugin is started.
2nd dialog with username and password on top of connection dialog if
you use bad credentials
--------------------------------------------------------------------------------------------
Key: JBIDE-12999
URL:
https://issues.jboss.org/browse/JBIDE-12999
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: openshift
Affects Versions: 4.0.0.Beta1
Reporter: Andre Dietisheim
Assignee: Andre Dietisheim
Fix For: 4.0.0.CR1
Attachments: existing-connection-auth-dialog.png, new-connection-auth-dialog.png
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira