[jbosstools-issues] [JBoss JIRA] (JBIDE-12999) 2nd dialog with username and password on top of connection dialog if you use bad credentials

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Wed Nov 7 10:38:18 EST 2012


    [ https://issues.jboss.org/browse/JBIDE-12999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732488#comment-12732488 ] 

Andre Dietisheim commented on JBIDE-12999:
------------------------------------------

There's another variant of overriding the org.eclipse.ui NetAuthenticator: ECF does this, too. It overrides any Authenticator that may be present in Eclipse and installs its own that would not lookup the eclipse proxy preferences:

{code:title=org.eclipse.ecf.provider.filetransfer.browse.URLFileSystemBrowser}
protected void setupAuthentication() throws IOException, UnsupportedCallbackException {
	if (connectContext == null)
		return;
	final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
	if (callbackHandler == null)
		return;
	final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
	final ObjectCallback passwordCallback = new ObjectCallback();
	// Call callback with username and password callbacks
	callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
	username = usernameCallback.getName();
	Object o = passwordCallback.getObject();
	if (!(o instanceof String))
		throw new UnsupportedCallbackException(passwordCallback, Messages.UrlConnectionRetrieveFileTransfer_UnsupportedCallbackException);
	password = (String) passwordCallback.getObject();
	// Now set authenticator to our authenticator with user and password
	Authenticator.setDefault(new UrlConnectionAuthenticator());
}

class UrlConnectionAuthenticator extends Authenticator {
	/* (non-Javadoc)
	 * @see java.net.Authenticator#getPasswordAuthentication()
	 */
	protected PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(username, password.toCharArray());
	}
}
{code}
                
> 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: Max Rydahl Andersen
>            Priority: Blocker
>             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


More information about the jbosstools-issues mailing list