Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.2.2 under development

- Bug #116: Fix authentication scheme in `HttpBearer` challenge according to RFC 6750 (@samdark)
- Chg #104: Bump minimal PHP version to 8.1 (@vjik)
- Enh #104: Explicitly mark readonly properties (@vjik)
- Enh #105: Explicitly import classes and functions in "use" section (@mspirkov)
Expand Down
2 changes: 1 addition & 1 deletion src/Method/HttpBearer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class HttpBearer extends HttpHeader

public function challenge(ResponseInterface $response): ResponseInterface
{
return $response->withHeader(Header::WWW_AUTHENTICATE, "{$this->headerName} realm=\"{$this->realm}\"");
return $response->withHeader(Header::WWW_AUTHENTICATE, "Bearer realm=\"{$this->realm}\"");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Method/CompositeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testChallengeIsCorrect(): void
]));

$this->assertEquals(
'Authorization realm="api"',
'Bearer realm="api"',
$authenticationMethod
->challenge($response)
->getHeaderLine(Header::WWW_AUTHENTICATE),
Expand Down
4 changes: 2 additions & 2 deletions tests/Method/HttpBearerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testChallengeIsCorrect(): void
$authenticationMethod = new HttpBearer($identityRepository);

$this->assertEquals(
'Authorization realm="api"',
'Bearer realm="api"',
$authenticationMethod
->challenge($response)
->getHeaderLine(Header::WWW_AUTHENTICATE),
Expand All @@ -71,7 +71,7 @@ public function testCustomRealm(): void
->withRealm('gateway');

$this->assertEquals(
'Authorization realm="gateway"',
'Bearer realm="gateway"',
$authenticationMethod
->challenge($response)
->getHeaderLine(Header::WWW_AUTHENTICATE),
Expand Down
Loading