[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Authority component in a p2 repository URI

Hi Ian,

I had a similar requirement and what I ended up doing was modifying DirectorApplication to supply credentials via UIServices. E.g.,

    private class AvoidTrustPromptService extends UIServices {

        @Override
        public AuthenticationInfo getUsernamePassword(String location) {
            return authenticationMap.get(location);
        }
...

I populate the authenticationMap through custom command-line arguments or a properties file; e.g.:

...
                authenticationMap.put(location, new UIServices.AuthenticationInfo(username, password, false));
...

Where location is your repository URL's hostname.

I couldn't find any other reasonable way for doing this in DirectorApplication. Frankly I was surprised that this wasn't a more common use-case for it -- I would think that authenticated repositories would be more commonly used in automation scenarios.

--Peter

On 1/31/13 2:02 PM, Ian Bull wrote:
I'm trying to access a p2 repository using the following syntax:


And it's failing a parse exception:

java.lang.NumberFormatException: For input string: "password@localhost"

From the stack, it appears that ECF is trying to use 'irbull' as the host and password@localhost as the port. In HttpClientFileSystemBrowse, the URI is converted to a String, and the string is parsed into components (host, port, etc..). Does anybody know if this is supported? If not, is there a URI syntax that we use for specifying usernames and passwords in p2?

Cheers,
Ian


--
R. Ian Bull | EclipseSource Victoria | +1 250 477 7484
http://eclipsesource.com | http://twitter.com/eclipsesource


_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev