Skip to content

Commit c63e351

Browse files
author
Vragov Roman
committed
Change OAuth\Event\AfterGrantAccessEvent
1 parent 69b68fb commit c63e351

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

composer.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
"autoload": {
2323
"psr-4": {
2424
"OAuth\\": "src"
25-
},
26-
"exclude-from-classmap": [
27-
"tests"
28-
]
25+
}
2926
},
3027
"autoload-dev": {
3128
"psr-4": {

src/Event/AfterGrantAccessEvent.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
namespace OAuth\Event;
66

7+
use OAuth\Server\GrantExtension\Grant;
8+
79
class AfterGrantAccessEvent
810
{
911
public function __construct(
1012
private readonly string $grantType,
11-
private readonly array $stored
13+
private readonly Grant $grant,
1214
) {
1315
}
1416

@@ -17,8 +19,8 @@ public function getGrantType(): string
1719
return $this->grantType;
1820
}
1921

20-
public function getStored(): array
22+
public function getGrant(): Grant
2123
{
22-
return $this->stored;
24+
return $this->grant;
2325
}
2426
}

src/Server/Handler.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public function grantAccessToken(Request $request): Response
154154
];
155155

156156
$input = filter_var_array($inputData, $filters);
157+
$input += $inputData;
157158

158159
if (!$input['grant_type']) {
159160
throw new OAuthServerException(Response::HTTP_BAD_REQUEST, ErrorCode::ERROR_INVALID_REQUEST, 'Invalid grant_type parameter or parameter missing');
@@ -212,11 +213,7 @@ public function grantAccessToken(Request $request): Response
212213
),
213214
};
214215

215-
$stored = [
216-
'scope' => $this->config->getVariable(Config::CONFIG_SUPPORTED_SCOPES),
217-
];
218-
219-
$this->eventDispatcher->dispatch(new AfterGrantAccessEvent($input['grant_type'], $stored));
216+
$this->eventDispatcher->dispatch(new AfterGrantAccessEvent($input['grant_type'], $grant));
220217

221218
$scope = $grant->getScope();
222219
if ($input['scope']) {

0 commit comments

Comments
 (0)