1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 10:22:42 +01:00
phorge-phorge/src/applications/auth/controller
epriestley db1cf41ec4 New Registration Workflow
Summary:
Currently, registration and authentication are pretty messy. Two concrete problems:

  - The `PhabricatorLDAPRegistrationController` and `PhabricatorOAuthDefaultRegistrationController` controllers are giant copy/pastes of one another. This is really bad.
  - We can't practically implement OpenID because we can't reissue the authentication request.

Additionally, the OAuth registration controller can be replaced wholesale by config, which is a huge API surface area and a giant mess.

Broadly, the problem right now is that registration does too much: we hand it some set of indirect credentials (like OAuth tokens) and expect it to take those the entire way to a registered user. Instead, break registration into smaller steps:

  - User authenticates with remote service.
  - Phabricator pulls information (remote account ID, username, email, real name, profile picture, etc) from the remote service and saves it as `PhabricatorUserCredentials`.
  - Phabricator hands the `PhabricatorUserCredentials` to the registration form, which is agnostic about where they originate from: it can process LDAP credentials, OAuth credentials, plain old email credentials, HTTP basic auth credentials, etc.

This doesn't do anything yet -- there is no way to create credentials objects (and no storage patch), but I wanted to get any initial feedback, especially about the event call for T2394. In particular, I think the implementation would look something like this:

  $profile = $event->getValue('profile')

  $username = $profile->getDefaultUsername();
  $is_employee = is_this_a_facebook_employee($username);
  if (!$is_employee) {
    throw new Exception("You are not employed at Facebook.");
  }

  $fbid = get_fbid_for_facebook_username($username);
  $profile->setDefaultEmail($fbid);

  $profile->setCanEditUsername(false);
  $profile->setCanEditEmail(false);
  $profile->setCanEditRealName(false);
  $profile->setShouldVerifyEmail(true);

Seem reasonable?

Test Plan: N/A yet, probably fatals.

Reviewers: vrana, btrahan, codeblock, chad

Reviewed By: btrahan

CC: aran, asherkin, nh, wez

Maniphest Tasks: T1536, T2394

Differential Revision: https://secure.phabricator.com/D4647
2013-06-16 10:13:49 -07:00
..
oauthregistration Migrate the OAuthInfo table to the ExternalAccount table 2013-06-14 07:04:41 -07:00
PhabricatorAuthController.php New Registration Workflow 2013-06-16 10:13:49 -07:00
PhabricatorAuthRegisterController.php New Registration Workflow 2013-06-16 10:13:49 -07:00
PhabricatorDisabledUserController.php Restore merge of phutil_tag. 2013-02-13 14:51:18 -08:00
PhabricatorEmailLoginController.php Restore merge of phutil_tag. 2013-02-13 14:51:18 -08:00
PhabricatorEmailTokenController.php Allow add_user.php without password auth 2013-05-24 16:05:14 -07:00
PhabricatorLDAPLoginController.php Migrate PhabricatorUserLDAPInfo to PhabricatorExternalAccount 2013-06-16 09:55:55 -07:00
PhabricatorLDAPRegistrationController.php Migrate PhabricatorUserLDAPInfo to PhabricatorExternalAccount 2013-06-16 09:55:55 -07:00
PhabricatorLDAPUnlinkController.php Migrate PhabricatorUserLDAPInfo to PhabricatorExternalAccount 2013-06-16 09:55:55 -07:00
PhabricatorLoginController.php make applicationTransactionsCommentView have a "Login to comment." button if user is not logged in 2013-03-07 13:02:36 -08:00
PhabricatorLoginValidateController.php Restore merge of phutil_tag. 2013-02-13 14:51:18 -08:00
PhabricatorLogoutController.php Restore merge of phutil_tag. 2013-02-13 14:51:18 -08:00
PhabricatorMustVerifyEmailController.php Restore merge of phutil_tag. 2013-02-13 14:51:18 -08:00
PhabricatorOAuthDiagnosticsController.php Restore merge of phutil_tag. 2013-02-13 14:51:18 -08:00
PhabricatorOAuthLoginController.php Migrate the OAuthInfo table to the ExternalAccount table 2013-06-14 07:04:41 -07:00
PhabricatorOAuthUnlinkController.php Internalize storage access for PhabricatorUserOAuthInfo 2013-06-14 07:00:29 -07:00
PhabricatorRefreshCSRFController.php Delete license headers from files 2012-11-05 11:16:51 -08:00