Authentication
P4 API for Java implements both the P4 Server tickets-based authentication and the P4 Server single sign on (SSO) feature. Both types of authentication are described in detail in the P4 API for Java Javadoc, but some P4 API for Java-specific issues to note include:
-
P4 API for Java manages a
p4 ticketsfile in a matter similar to that of the P4 command line (under normal circumstances, the two can share the same tickets file). When a ticket value is requested by the P4 Server and the current ticket value in the associatedIOptionsServerobject is not set, an attempt is made to retrieve the ticket out of thep4 ticketsfile. If found, the ticket is stored on theIOptionsServerobject and used as the P4 Server authentication ticket.A successful login causes the ticket value to be added or updated in the tickets file, and a logout causes the current ticket value in the
p4 ticketsfile to be removed. TheIOptionsServerobject’s ticket should be set tonullto cause a re-reading of the ticket value from thep4 ticketsfile.The
p4 ticketsfile is usually stored in the same place thep4command line stores it, but thePropertyDefs.TICKET_PATH_KEYproperty can be used to specify an alternate tickets file. - P4 API for Java implements
P4 Server’s SSO
scheme using a callback interface described in the
ISSOCallbackJavadoc (in the packagecom.perforce.p4java.server.callback). Ensure that the callback doesn’t block, and that it adheres to the expected format of the associated P4 Server.