Skip to content

Commit cc86f3c

Browse files
committed
revert continue default to false
1 parent fd48045 commit cc86f3c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

config/bootstrap.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ class_alias($appControllerReal, $appControllerAlias);
1313
if (!class_exists('Cake\Http\Exception\HttpException')) {
1414
class_alias('Cake\Network\Exception\HttpException', 'Cake\Http\Exception\HttpException');
1515
}
16+
if (!class_exists('Cake\Http\Exception\BadRequestException')) {
17+
class_alias('Cake\Network\Exception\BadRequestException', 'Cake\Http\Exception\BadRequestException');
18+
}
1619
if (!class_exists('Cake\Http\Exception\NotImplementedException')) {
1720
class_alias('Cake\Network\Exception\NotImplementedException', 'Cake\Http\Exception\NotImplementedException');
1821
}
19-
if (!class_exists('Cake\Http\Exception\BadRequestException')) {
20-
class_alias('Cake\Network\Exception\BadRequestException', 'Cake\Http\Exception\BadRequestException');
22+
if (!class_exists('Cake\Http\Exception\UnauthorizedException')) {
23+
class_alias('Cake\Network\Exception\UnauthorizedException', 'Cake\Http\Exception\UnauthorizedException');
2124
}

src/Auth/OAuthAuthenticate.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Cake\Controller\ComponentRegistry;
77
use Cake\Core\Configure;
88
use Cake\Http\Exception\BadRequestException;
9-
use Cake\Http\Exception\HttpException;
9+
use Cake\Http\Exception\UnauthorizedException;
1010
use Cake\Http\Response;
1111
use Cake\Http\ServerRequest;
1212
use League\OAuth2\Server\Exception\OAuthServerException;
@@ -32,7 +32,7 @@ class OAuthAuthenticate extends BaseAuthenticate
3232
* @var array
3333
*/
3434
protected $_defaultConfig = [
35-
'continue' => true,
35+
'continue' => false,
3636
'publicKey' => null,
3737
'fields' => [
3838
'username' => 'id',
@@ -107,9 +107,7 @@ public function unauthenticated(ServerRequest $request, Response $response)
107107
}
108108

109109
if (isset($this->_exception)) {
110-
// ignoring $e->getHttpHeaders() for now
111-
// it only sends WWW-Authenticate header in case of InvalidClientException
112-
throw new HttpException($this->_exception->getMessage(), $this->_exception->getHttpStatusCode(), $this->_exception);
110+
throw new UnauthorizedException($this->_exception->getMessage(), $this->_exception->getHttpStatusCode(), $this->_exception);
113111
}
114112

115113
$message = __d('authenticate', 'You are not authenticated.');

0 commit comments

Comments
 (0)