Page MenuHomePhabricator

final class PhabricatorCookies
Phabricator Technical Documentation (Auth)

Consolidates Phabricator application cookies, including registration and session management.

Tasks

Client ID Cookie

  • public static function setClientIDCookie($request) — Set the client ID cookie. This is a random cookie used like a CSRF value during authentication workflows.

Next URI Cookie

  • public static function setNextURICookie($request, $next_uri, $force) — Set the Next URI cookie. We only write the cookie if it wasn't recently written, to avoid writing over a real URI with a bunch of "humans.txt" stuff. See T3793 for discussion.
  • public static function getNextURICookie($request) — Read the URI out of the Next URI cookie.
  • private static function parseNextURICookie($cookie) — Parse a Next URI cookie into its components.

Methods

public static function setClientIDCookie($request)

Set the client ID cookie. This is a random cookie used like a CSRF value during authentication workflows.

Parameters
AphrontRequest$requestRequest to modify.
Return
void

public static function setNextURICookie($request, $next_uri, $force)

Set the Next URI cookie. We only write the cookie if it wasn't recently written, to avoid writing over a real URI with a bunch of "humans.txt" stuff. See T3793 for discussion.

Parameters
AphrontRequest$requestRequest to write to.
string$next_uriURI to write.
bool$forceWrite this cookie even if we have a fresh cookie already.
Return
void

public static function getNextURICookie($request)

Read the URI out of the Next URI cookie.

Parameters
AphrontRequest$requestRequest to examine.
Return
string|nullNext URI cookie's URI value.

private static function parseNextURICookie($cookie)

Parse a Next URI cookie into its components.

Parameters
string$cookieRaw cookie value.
Return
list<string>List of timestamp and URI.