From 885805f34067cff8596d2769612ed0061ac1810b Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 15 Nov 2016 09:07:45 -0800 Subject: [PATCH] Make Passphrase "token" credentials accessible via the API Summary: Fixes T11867. This should really be on the `CredentialType` itself, but just punt that for now until the API endpoint gets updated. We'll need the actual code here anyway in some form. Test Plan: {F1922728} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11867 Differential Revision: https://secure.phabricator.com/D16864 --- .../conduit/PassphraseQueryConduitAPIMethod.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/applications/passphrase/conduit/PassphraseQueryConduitAPIMethod.php b/src/applications/passphrase/conduit/PassphraseQueryConduitAPIMethod.php index 387e01cb2e..a9375c1b67 100644 --- a/src/applications/passphrase/conduit/PassphraseQueryConduitAPIMethod.php +++ b/src/applications/passphrase/conduit/PassphraseQueryConduitAPIMethod.php @@ -82,7 +82,7 @@ final class PassphraseQueryConduitAPIMethod switch ($credential->getCredentialType()) { case PassphraseSSHPrivateKeyFileCredentialType::CREDENTIAL_TYPE: - if ($secret) { + if ($secret !== null) { $material['file'] = $secret; } if ($public_key) { @@ -91,7 +91,7 @@ final class PassphraseQueryConduitAPIMethod break; case PassphraseSSHGeneratedKeyCredentialType::CREDENTIAL_TYPE: case PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE: - if ($secret) { + if ($secret !== null) { $material['privateKey'] = $secret; } if ($public_key) { @@ -99,10 +99,15 @@ final class PassphraseQueryConduitAPIMethod } break; case PassphrasePasswordCredentialType::CREDENTIAL_TYPE: - if ($secret) { + if ($secret !== null) { $material['password'] = $secret; } break; + case PassphraseTokenCredentialType::CREDENTIAL_TYPE: + if ($secret !== null) { + $material['token'] = $secret; + } + break; } if (!$allow_api) {