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
6 changes: 0 additions & 6 deletions .roave-backward-compatibility-check.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
xsi:noNamespaceSchemaLocation="vendor/roave/backward-compatibility-check/Resources/schema.xsd">
<baseline>
<ignored-regex>#\[BC\] SKIPPED: Roave\\BetterReflection\\Reflection\\ReflectionClass "Yiisoft\\Yii\\Debug#</ignored-regex>
<!--
AuthenticationMethodInterface now extends AuthenticatorInterface, so accepting AuthenticatorInterface widens
the constructor parameter type. Roave compares the two package versions independently and cannot resolve this
newly introduced cross-version parent relationship as contravariant.
-->
<ignored-regex>#^\[BC\] CHANGED: The parameter \$authenticationMethod of Yiisoft\\Auth\\Middleware\\Authentication\#__construct\(\) changed from Yiisoft\\Auth\\AuthenticationMethodInterface to a non-contravariant Yiisoft\\Auth\\AuthenticatorInterface$#</ignored-regex>
</baseline>
</roave-bc-check>
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 3.3.1 under development

- Bug #124: Fix `HttpBasic` and `HttpBearer` to add `WWW-Authenticate` header instead of overwriting it (@vjik)
- Bug #128: Fix BC-breaking change in `Authentication` middleware constructor parameter type (@vjik)

## 3.3.0 August 06, 2026

Expand Down
3 changes: 2 additions & 1 deletion src/Middleware/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Yiisoft\Auth\AuthenticationMethodInterface;
use Yiisoft\Auth\AuthenticatorInterface;
use Yiisoft\Auth\AuthenticatorWithChallengeInterface;
use Yiisoft\Auth\Handler\AuthenticationFailureHandler;
Expand Down Expand Up @@ -36,7 +37,7 @@ final class Authentication implements MiddlewareInterface
private array $wildcards = [];

public function __construct(
private AuthenticatorInterface $authenticationMethod,
private AuthenticatorInterface|AuthenticationMethodInterface $authenticationMethod,
ResponseFactoryInterface $responseFactory,
?RequestHandlerInterface $authenticationFailureHandler = null,
) {
Expand Down
Loading