Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15461524
D7963.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7963.diff
View Options
Index: src/applications/auth/controller/PhabricatorAuthController.php
===================================================================
--- src/applications/auth/controller/PhabricatorAuthController.php
+++ src/applications/auth/controller/PhabricatorAuthController.php
@@ -65,7 +65,7 @@
protected function loginUser(PhabricatorUser $user) {
$response = $this->buildLoginValidateResponse($user);
- $session_type = 'web';
+ $session_type = PhabricatorAuthSession::TYPE_WEB;
$event_type = PhabricatorEventType::TYPE_AUTH_WILLLOGINUSER;
$event_data = array(
Index: src/applications/auth/engine/PhabricatorAuthSessionEngine.php
===================================================================
--- src/applications/auth/engine/PhabricatorAuthSessionEngine.php
+++ src/applications/auth/engine/PhabricatorAuthSessionEngine.php
@@ -36,7 +36,8 @@
* You can configure the maximum number of concurrent sessions for various
* session types in the Phabricator configuration.
*
- * @param string Session type, like "web".
+ * @param const Session type constant (see
+ * @{class:PhabricatorAuthSession}).
* @param phid Identity to establish a session for, usually a user PHID.
* @return string Newly generated session key.
*/
@@ -56,10 +57,10 @@
$session_limit = 1;
switch ($session_type) {
- case 'web':
+ case PhabricatorAuthSession::TYPE_WEB:
$session_limit = PhabricatorEnv::getEnvConfig('auth.sessions.web');
break;
- case 'conduit':
+ case PhabricatorAuthSession::TYPE_CONDUIT:
$session_limit = PhabricatorEnv::getEnvConfig('auth.sessions.conduit');
break;
default:
Index: src/applications/auth/storage/PhabricatorAuthSession.php
===================================================================
--- src/applications/auth/storage/PhabricatorAuthSession.php
+++ src/applications/auth/storage/PhabricatorAuthSession.php
@@ -3,6 +3,9 @@
final class PhabricatorAuthSession extends PhabricatorAuthDAO
implements PhabricatorPolicyInterface {
+ const TYPE_WEB = 'web';
+ const TYPE_CONDUIT = 'conduit';
+
protected $userPHID;
protected $type;
protected $sessionKey;
Index: src/applications/base/controller/PhabricatorController.php
===================================================================
--- src/applications/base/controller/PhabricatorController.php
+++ src/applications/base/controller/PhabricatorController.php
@@ -38,7 +38,7 @@
$phsid = $request->getCookie('phsid');
if ($phsid) {
$session_user = id(new PhabricatorAuthSessionEngine())
- ->loadUserForSession('web', $phsid);
+ ->loadUserForSession(PhabricatorAuthSession::TYPE_WEB, $phsid);
if ($session_user) {
$user = $session_user;
}
Index: src/applications/conduit/controller/PhabricatorConduitAPIController.php
===================================================================
--- src/applications/conduit/controller/PhabricatorConduitAPIController.php
+++ src/applications/conduit/controller/PhabricatorConduitAPIController.php
@@ -280,7 +280,7 @@
}
$user = id(new PhabricatorAuthSessionEngine())
- ->loadUserForSession('conduit', $session_key);
+ ->loadUserForSession(PhabricatorAuthSession::TYPE_CONDUIT, $session_key);
if (!$user) {
return array(
Index: src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php
===================================================================
--- src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php
+++ src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php
@@ -143,7 +143,9 @@
throw new ConduitException('ERR-INVALID-CERTIFICATE');
}
$session_key = id(new PhabricatorAuthSessionEngine())
- ->establishSession('conduit', $user->getPHID());
+ ->establishSession(
+ PhabricatorAuthSession::TYPE_CONDUIT,
+ $user->getPHID());
} else {
throw new ConduitException('ERR-NO-CERTIFICATE');
}
Index: src/applications/settings/panel/PhabricatorSettingsPanelConduit.php
===================================================================
--- src/applications/settings/panel/PhabricatorSettingsPanelConduit.php
+++ src/applications/settings/panel/PhabricatorSettingsPanelConduit.php
@@ -37,7 +37,7 @@
$sessions = id(new PhabricatorAuthSessionQuery())
->setViewer($user)
->withIdentityPHIDs(array($user->getPHID()))
- ->withSessionTypes(array('conduit'))
+ ->withSessionTypes(array(PhabricatorAuthSession::TYPE_CONDUIT))
->execute();
foreach ($sessions as $session) {
$session->delete();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 2, 8:57 AM (3 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7490149
Default Alt Text
D7963.diff (4 KB)
Attached To
Mode
D7963: Replace "web" and "conduit" magic session strings with constants
Attached
Detach File
Event Timeline
Log In to Comment