This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207897

Summary: AdminAuthenticator prevents Git support from push
Product: serverplugins Reporter: Ondrej Vrabec <ovrabec>
Component: GlassFishAssignee: Ondrej Vrabec <ovrabec>
Status: VERIFIED FIXED    
Severity: normal CC: mmirilovic, stezeb
Priority: P2    
Version: 7.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 207789    
Attachments: fix proposal

Description Ondrej Vrabec 2012-01-30 09:13:24 UTC
glassfish.common/src/org/netbeans/modules/glassfish/common/AdminAuthenticator.java permanently replaces org.netbeans.core.NbAuthenticator as a default java.net.Authenticator. I don't know if that's correct or not, but that's not the point.
Git support uses a 3rd-party library (JGit) for communication with remote repositories and that library handles authentication and authorization itself. But when any NB implementation of a java.net.Authenticator comes in the way, the connection (push command to be more precise) fails. For that reason we modified org.netbeans.core.NbAuthenticator in 7.1 to be capable of working with mechanisms that do not require (refuse actually) the dialog asking for username and password. Do you think you could rewrite AdminAuthenticator to work the same way?

Scenario:
1) Git runs a git command in:
> org.openide.util.suppressAuthenticationDialog(Callable<R> blockOfCode)
that sets a flag that tells the default NB authenticator to suppress the dialog and return null when getPasswordAuthentication is called
2) When getPasswordAuthentication is called, NbAuthenticator displays the dialog only when:
> NetworkSettings.isAuthenticationDialogSuppressed()
returns false
3) For a git command, the dialog is then never displayed and it successfully connects to a remote repository

Do you think you could display the dialog only when NetworkSettings.isAuthenticationDialogSuppressed() returns false also in:
glassfish.common/src/org/netbeans/modules/glassfish/common/AdminAuthenticator.java
j2ee.sun.appsrv/src/org/netbeans/modules/j2ee/sun/ide/editors/AdminAuthenticator.java - i don't know if you manage this class too. If so, please modify it, if not pass forward.
Thanks
Comment 1 Ondrej Vrabec 2012-01-30 09:14:14 UTC
Created attachment 115371 [details]
fix proposal
Comment 2 Ondrej Vrabec 2012-01-30 10:09:20 UTC
fix: http://hg.netbeans.org/core-main/rev/602bbebb9c1e
Comment 3 Vince Kraemer 2012-01-31 04:12:23 UTC
thanks for taking care of this.
Comment 4 Stepan Zebra 2012-02-03 14:42:43 UTC
verified in trunk
(running GF from IDE doesn't interfere with Git authentication anymore after the patch)
Comment 5 Ondrej Vrabec 2012-02-07 14:36:38 UTC
7.1.1 ix: http://hg.netbeans.org/releases/rev/95f8c14eb2de
Comment 6 Quality Engineering 2012-02-08 02:33:38 UTC
Integrated into 'releases', will be available in build *201202072200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/95f8c14eb2de
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #207897 - AdminAuthenticator prevents Git support from push
honor NetworkSettings.isAuthenticationDialogSuppressed
(transplanted from 602bbebb9c1e486a57237196ef8780b38a2336c9)
Comment 7 Stepan Zebra 2012-02-14 16:49:31 UTC
verified in 7.1.1