Authentication
P4Java implements both the Helix Server tickets-based authentication and the Helix Server single sign on (SSO) feature. Both types of authentication are described in detail in the P4Java Javadoc, but some P4Java-specific issues to note include:
-
P4Java manages a
p4 tickets
file 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 Helix Server and the current ticket value in the associatedIOptionsServer
object is not set, an attempt is made to retrieve the ticket out of thep4 tickets
file. If found, the ticket is stored on theIOptionsServer
object and used as the Helix 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 tickets
file to be removed. TheIOptionsServer
object’s ticket should be set tonull
to cause a re-reading of the ticket value from thep4 tickets
file.The
p4 tickets
file is usually stored in the same place thep4
command line stores it, but thePropertyDefs.TICKET_PATH_KEY
property can be used to specify an alternate tickets file. - P4Java implements
Helix Server’s SSO
scheme using a callback interface described in the
ISSOCallback
Javadoc (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 Helix Server.