Closed FredChap closed 10 years ago
Hello,
Starting from the 0.0.7-SNAPSHOT sources, I could have it work behind a proxy requiring authentication. Here below is what I did.
Suggested fix in the API:
Corresponding fix in the plugin class AbstractPhoneGapBuildMojo.java : ProxyInfo proxyInfo = wagonManager.getProxy("http"); if (proxyInfo != null) { try { getLog().info("Using Proxy username : " + proxyInfo.getUserName() ); URI uri = new URI("http", null, proxyInfo.getHost(), proxyInfo.getPort(), null, null, null); rootWebResource = meManager.createRootWebResource(username, password, uri.toString(), proxyInfo.getUserName(), proxyInfo.getPassword() ); } catch (URISyntaxException e) { throw new ApiException("Could not load http proxy settings", e); } } else { rootWebResource = meManager.createRootWebResource(username, password); }
I'm glad you fixed your problem and thanks for providing the solution, if you're willing to put it into a PR I can make it available to others?
On Tue, Feb 4, 2014 at 12:57 PM, FredChap notifications@github.com wrote:
Hello,
Starting from the 0.0.7-SNAPSHOT sources, I could have it work behind a proxy requiring authentication. Here below is what I did.
Suggested fix in the API:
- Add new method signature in interface MeManager.java: public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
- Replace previous createRootWebResource method implementation with a call to new method signature: @Override https://github.com/Override public WebResource createRootWebResource(String username, String password, String proxyUri) { return createRootWebResource(username, password, proxyUri, null, null); }
- Add following code in new method implementation of class MeManagerImpl.java: ... // set proxy auth credentials if ( proxyUser != null & proxyPwd != null ) { config.getState().setProxyCredentials(null, null, -1, proxyUser, proxyPwd ); } // set http auth credentials ...
Corresponding fix in the plugin class AbstractPhoneGapBuildMojo.java : ProxyInfo proxyInfo = wagonManager.getProxy("http"); if (proxyInfo != null) { try { getLog().info("Using Proxy username : " + proxyInfo.getUserName() ); URI uri = new URI("http", null, proxyInfo.getHost(), proxyInfo.getPort(), null, null, null); rootWebResource = meManager.createRootWebResource(username, password, uri.toString(), proxyInfo.getUserName(), proxyInfo.getPassword() ); } catch (URISyntaxException e) { throw new ApiException("Could not load http proxy settings", e); } } else { rootWebResource = meManager.createRootWebResource(username, password); }
Reply to this email directly or view it on GitHubhttps://github.com/chrisprice/phonegap-build/issues/15#issuecomment-34056567 .
Sure you can, do you want me to send the complete files ?
That would be great, ideally as part of a pull request.
Ok, it's been forked and pushed. Don't know exactly how it works but I guess you are the one who can pull the changes for a future release.
Normally you'd just press the Pull Request button, but I managed to find this site which let me do it for you.
Thanks again, I'll pull this in and do a release as soon as I get a chance.
Chris Price » phonegap-build #59 UNSTABLE Looks like there's a problem with this pull request (what's this?)
Doh, it looks like there's a test failure.
Yes, I've seen that, I did all this skipping tests. I'll have a look asap.
Well I know nothing about jmock so I will need some advice. Apparently, since I am calling the new method with 2 strings added for credential information, I guess test method testGetRootWebResource_proxySpecifiedPositive() should check something like: oneOf(meManager).createRootWebResource("user", "pass", "http://localhost:8888",null,null); Right ?
Chris Price » phonegap-build #60 SUCCESS This pull request looks good (what's this?)
In method getRootWebResource of class AbstractPhoneGapBuildMojo, proxy credentials are not used. Instead the Phonegap Build server credentials are used which fails when building behind a proxy.