Skip to content

Commit e1040f3

Browse files
[13.x] Force confidential PAT client (#1761)
1 parent 1e3ebb3 commit e1040f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Bridge/PersonalAccessGrant.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace Laravel\Passport\Bridge;
44

55
use DateInterval;
6+
use League\OAuth2\Server\Exception\OAuthServerException;
67
use League\OAuth2\Server\Grant\AbstractGrant;
8+
use League\OAuth2\Server\RequestEvent;
79
use League\OAuth2\Server\ResponseTypes\ResponseTypeInterface;
810
use Psr\Http\Message\ServerRequestInterface;
911

@@ -19,6 +21,13 @@ public function respondToAccessTokenRequest(
1921
): ResponseTypeInterface {
2022
// Validate request
2123
$client = $this->validateClient($request);
24+
25+
if (! $client->isConfidential()) {
26+
$this->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request));
27+
28+
throw OAuthServerException::invalidClient($request);
29+
}
30+
2231
$scopes = $this->validateScopes($this->getRequestParameter('scope', $request, $this->defaultScope));
2332
$userIdentifier = $this->getRequestParameter('user_id', $request);
2433

0 commit comments

Comments
 (0)