1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

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
This commit is contained in:
epriestley 2016-11-15 09:07:45 -08:00
parent 508d86aab6
commit 885805f340

View file

@ -82,7 +82,7 @@ final class PassphraseQueryConduitAPIMethod
switch ($credential->getCredentialType()) { switch ($credential->getCredentialType()) {
case PassphraseSSHPrivateKeyFileCredentialType::CREDENTIAL_TYPE: case PassphraseSSHPrivateKeyFileCredentialType::CREDENTIAL_TYPE:
if ($secret) { if ($secret !== null) {
$material['file'] = $secret; $material['file'] = $secret;
} }
if ($public_key) { if ($public_key) {
@ -91,7 +91,7 @@ final class PassphraseQueryConduitAPIMethod
break; break;
case PassphraseSSHGeneratedKeyCredentialType::CREDENTIAL_TYPE: case PassphraseSSHGeneratedKeyCredentialType::CREDENTIAL_TYPE:
case PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE: case PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE:
if ($secret) { if ($secret !== null) {
$material['privateKey'] = $secret; $material['privateKey'] = $secret;
} }
if ($public_key) { if ($public_key) {
@ -99,10 +99,15 @@ final class PassphraseQueryConduitAPIMethod
} }
break; break;
case PassphrasePasswordCredentialType::CREDENTIAL_TYPE: case PassphrasePasswordCredentialType::CREDENTIAL_TYPE:
if ($secret) { if ($secret !== null) {
$material['password'] = $secret; $material['password'] = $secret;
} }
break; break;
case PassphraseTokenCredentialType::CREDENTIAL_TYPE:
if ($secret !== null) {
$material['token'] = $secret;
}
break;
} }
if (!$allow_api) { if (!$allow_api) {