OAuth - add concept of "trusted" clients that get auto redirects

Summary: Fixes T7153.

Test Plan:
used `bin/auth trust-oauth-client` and `bin/auth untrust-oauth-client` to set the bit and verify error states.

registered via oauth with `bin/auth trust-oauth-client` set and I did not have the confirmation screen
registered via oauth with `bin/auth untrust-oauth-client` set and I did have the confirmation screen

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7153

Differential Revision: https://secure.phabricator.com/D11724
This commit is contained in:
Bob Trahan
2015-02-09 14:23:49 -08:00
parent 7cbdfbee24
commit 03639a7c1e
6 changed files with 138 additions and 0 deletions

View File

@@ -182,6 +182,12 @@ final class PhabricatorOAuthServerAuthController
'state' => $state,
));
if ($client->getIsTrusted()) {
return id(new AphrontRedirectResponse())
->setIsExternal(true)
->setURI((string)$full_uri);
}
// TODO: It would be nice to give the user more options here, like
// reviewing permissions, canceling the authorization, or aborting
// the workflow.

View File

@@ -10,6 +10,7 @@ final class PhabricatorOAuthServerClient
protected $name;
protected $redirectURI;
protected $creatorPHID;
protected $isTrusted = 0;
protected $viewPolicy;
protected $editPolicy;
@@ -40,6 +41,7 @@ final class PhabricatorOAuthServerClient
'name' => 'text255',
'secret' => 'text32',
'redirectURI' => 'text255',
'isTrusted' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,