Add enhanced support for Perforce ticket-based authentication.
Review Request #8949 — Created May 18, 2017 and submitted — Latest diff uploaded
We've had support for using tickets for a long time, but the support was a bit lazy. We'd still perform a login request on each session using the provided username and password, using this to fetch/extend the ticket needed for the session. On some setups, this could be a slow process, as it could end up hitting multi-tenant Active Directory servers or it might go through Perforce proxy servers, adding time to the request. Now the locally-cached ticket is checked before attempting to perform a login. If there is no ticket state, or the ticket is close to expiring (within 1 hour), a login is performed to refresh the ticket. Otherwise, the ticket is used as-is. The ticket files also now live within a namespaced location in the site's data directory. The location contains the Local Site name, if any, making it easier to separate out the content for the purposes of cleanup or debugging.
Unit tests pass.
Manually tested the following conditions:
- No existing ticket stored locally or on the server.
- No existing ticket stored locally, but ticket known on the server.
- Existing unexpired local ticket.
- Existing unexpired but soon-to-be-expired local ticket.
- Expired local ticket.
Checked that logins only happened when there were no local tickets or
the tickets were soon going to expire.