Skip to content

Commit 2c0df5b

Browse files
committed
[BUGFIX] Skip bearer auth flow when Authorization header is absent
authenticateBearerToken() destructures the scheme and token from the Authorization header. The previous guard returned early only when a scheme was present but did not equal "bearer". For requests without an Authorization header (or with an unparseable header that yields no scheme), $scheme is null, the guard did not trigger, and the function fell through to TokenRepository::findBackendUserIdByToken(null) which raised a TypeError because the argument is typed as string. Invert the guard so it also early-returns when the scheme is not a string. Smallest possible change: keeps the same single-statement structure and the same is_string() helper that was already used.
1 parent 29c744c commit 2c0df5b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Classes/Authentication/HttpBackendUserAuthentication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function authenticateBearerToken(ServerRequestInterface $request): voi
115115

116116
[$scheme, $token] = GeneralUtility::trimExplode(' ', $authorizationHeader, true);
117117

118-
if (is_string($scheme) && strtolower($scheme) !== 'bearer') {
118+
if (!is_string($scheme) || strtolower($scheme) !== 'bearer') {
119119
return;
120120
}
121121

0 commit comments

Comments
 (0)