Page MenuHomePhorge
Diviner Tech Docs PhabricatorCookies

final class PhabricatorCookies
Phorge 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.

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

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.