Menu

#7 login helper methods for Connection

Next Release
open
5
2008-07-27
2008-07-27
Lewis Baker
No

It would be nice to have some helper methods to simplify the process of authenticating with Perforce.

eg.
p4 = Connection()
p4.connect()
p4.login(password='secret')

In the simple case this could just map onto the call to p4.run("login", input='secret'). However, this call will result in an update to the P4TICKETS file which may not be ideal for certain types of scripts.

Perhaps support for something along the lines of p4.login(password='secret', persistTicket=False) to disable update of the P4TICKETS file by using "p4 login -p" to obtain the ticket value itself and auto-update the Connection.password attribute for this connection only.

Support for an 'allHosts' parameter to allow creation of a ticket that is valid on all hosts could be added.

Also need to consider support for the new (currently undocumented) SSO feature where the authentication credentials are obtained from the output of running a script (eg. that uses Kerberos auth) rather than from a password.

A corresponding Connection.logout() method would also be useful, as would some sort of method for querying whether the user is currently authenticated. eg. via either a Connection.isLoggedIn() method that returns a boolean or a Connection.getTicketValidityTime() that returns a datetime.timedelta value.

Discussion


Log in to post a comment.