Java Connect Perforce Using the Keys

270 Views Asked by At

My Requirement is I want to connect to a perforce server "abc.def.com:1689" to access it requires my public and private key (identity basically) Now I want to achieve same using the Java Program.

I want to connect to the Perforce server and perform actions programmatically its not a username and password base model it uses the private key to authenticate user and allow access to the repository.

Can someone guide me on this I have already tried few suggestions mentioned in the other stackoverflow links but its not working.

String uri = "p4javassl://abc.def.com:1689";
            IOptionsServer server = ServerFactory.getOptionsServer(uri, null);
            server.addTrust("somefingerPrint");
            server.connect();
            IServerInfo sInfo = server.getServerInfo();
            System.out.println("user "+sInfo.getUserName());

com.perforce.p4java.exception.ConnectionException: Unable to connect to Perforce server

1

There are 1 best solutions below

3
On

If I understand correctly you want to authenticate to a Helix server with a client cert. That's not possible.

The Perforce/Helix server always needs a user for authorization as file/resource protections are based on your user. You will always need to set your user:

server.setUserName('Vikki');