Skip to content

Commit 1188876

Browse files
Toby Hughesepriestley
authored andcommitted
Fix exception in OAuthServerAuthController
Summary: We've been building a Jenkins plugin that allows you to use your Phabricator login details in Jenkins using the inbuilt OAuthServer. I noticed that when making a request to /oauthserver/auth/?client_id=&response_type=code I get an error back from the server. I've traced this down to two bugs in PhabricatorOAuthServerAuthController, the first causes a null value error on $access_token_uri, and the second fails on userHasAuthorizedClient without a $scope array. Test Plan: Go to /oauthserver/auth/?client_id=<client_id>&response_type=code and get a valid authorization code back Reviewers: epriestley, btrahan Reviewed By: btrahan CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4808
1 parent f912fa1 commit 1188876

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function processRequest() {
1515
$current_user = $request->getUser();
1616
$server = new PhabricatorOAuthServer();
1717
$client_phid = $request->getStr('client_id');
18-
$scope = $request->getStr('scope');
18+
$scope = $request->getStr('scope', array());
1919
$redirect_uri = $request->getStr('redirect_uri');
2020
$state = $request->getStr('state');
2121
$response_type = $request->getStr('response_type');
@@ -63,10 +63,8 @@ public function processRequest() {
6363
return $response;
6464
}
6565
$uri = $redirect_uri;
66-
$access_token_uri = $uri;
6766
} else {
6867
$uri = new PhutilURI($client->getRedirectURI());
69-
$access_token_uri = null;
7068
}
7169
// we've now validated this request enough overall such that we
7270
// can safely redirect to the client with the response
@@ -121,7 +119,7 @@ public function processRequest() {
121119
if ($return_auth_code) {
122120
// step 1 -- generate authorization code
123121
$auth_code =
124-
$server->generateAuthorizationCode($access_token_uri);
122+
$server->generateAuthorizationCode($uri);
125123

126124
// step 2 return it
127125
$content = array(

0 commit comments

Comments
 (0)