Page MenuHomePhabricator

D16989.id40878.diff
No OneTemporary

D16989.id40878.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -321,7 +321,6 @@
'PhutilPayPalAPIFuture' => 'future/paypal/PhutilPayPalAPIFuture.php',
'PhutilPerson' => 'internationalization/PhutilPerson.php',
'PhutilPersonTest' => 'internationalization/__tests__/PhutilPersonTest.php',
- 'PhutilPersonaAuthAdapter' => 'auth/PhutilPersonaAuthAdapter.php',
'PhutilPhabricatorAuthAdapter' => 'auth/PhutilPhabricatorAuthAdapter.php',
'PhutilPhtTestCase' => 'internationalization/__tests__/PhutilPhtTestCase.php',
'PhutilPirateEnglishLocale' => 'internationalization/locales/PhutilPirateEnglishLocale.php',
@@ -929,7 +928,6 @@
'Phobject',
'PhutilPerson',
),
- 'PhutilPersonaAuthAdapter' => 'PhutilAuthAdapter',
'PhutilPhabricatorAuthAdapter' => 'PhutilOAuthAuthAdapter',
'PhutilPhtTestCase' => 'PhutilTestCase',
'PhutilPirateEnglishLocale' => 'PhutilLocale',
diff --git a/src/auth/PhutilPersonaAuthAdapter.php b/src/auth/PhutilPersonaAuthAdapter.php
deleted file mode 100644
--- a/src/auth/PhutilPersonaAuthAdapter.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Authentication adapter for Mozilla's Persona.
- */
-final class PhutilPersonaAuthAdapter extends PhutilAuthAdapter {
-
- private $audience;
- private $assertion;
- private $accountData;
-
- public function setAssertion($assertion) {
- $this->assertion = $assertion;
- return $this;
- }
-
- public function setAudience($audience) {
- $this->audience = $audience;
- return $this;
- }
-
- public function getAdapterDomain() {
- return 'verifier.login.persona.org';
- }
-
- public function getAdapterType() {
- return 'persona';
- }
-
- public function getAccountEmail() {
- return $this->getAccountID();
- }
-
- public function getAccountID() {
- if ($this->accountData === null) {
- $verify_uri = 'https://verifier.login.persona.org/verify';
- $data = array(
- 'audience' => $this->audience,
- 'assertion' => $this->assertion,
- );
-
- list($body) = id(new HTTPSFuture($verify_uri, json_encode($data)))
- ->setMethod('POST')
- ->addHeader('Content-Type', 'application/json')
- ->resolvex();
-
- $response = null;
- try {
- $response = phutil_json_decode($body);
- } catch (PhutilJSONParserException $ex) {
- throw new PhutilProxyException(
- pht('Unexpected Persona response.'),
- $ex);
- }
-
- $audience = idx($response, 'audience');
- if ($audience != $this->audience) {
- throw new Exception(pht('Mismatched Persona audience: %s', $audience));
- }
-
- if (idx($response, 'status') !== 'okay') {
- $reason = idx($response, 'reason', pht('Unknown'));
- throw new Exception(pht('Persona login failed: %s', $reason));
- }
-
- $this->accountData = $response;
- }
-
- return idx($this->accountData, 'email');
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 10, 2:08 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7325365
Default Alt Text
D16989.id40878.diff (2 KB)

Event Timeline