Skip to content

Commit 3df14d1

Browse files
Merge pull request #3 from flownative/main
Importing fixes from base repository
2 parents 520caff + 98a631a commit 3df14d1

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Classes/Authentication/OpenIdConnectProvider.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ public function authenticate(TokenInterface $authenticationToken): void
9393
try {
9494
$jwks = (new OpenIdConnectClient($this->options['serviceName']))->getJwks();
9595
$identityToken = $authenticationToken->extractIdentityTokenFromRequest($this->options['jwtCookieName']);
96-
if (!$identityToken->hasValidSignature($jwks)) {
96+
97+
try {
98+
$hasValidSignature = $identityToken->hasValidSignature($jwks);
99+
} catch (ServiceException $exception) {
100+
throw new SecurityException('Open ID Connect: ' . $exception->getMessage(), 1671105913, $exception);
101+
}
102+
if (!$hasValidSignature) {
97103
throw new SecurityException('Open ID Connect: The identity token provided by the OIDC provider had an invalid signature', 1561479176);
98104
}
99105
$this->logger->debug(sprintf('OpenID Connect: Successfully verified signature of identity token with %s value "%s"', $this->options['accountIdentifierTokenValueName'], $identityToken->values[$this->options['accountIdentifierTokenValueName']] ?? 'unknown'), LogEnvironment::fromMethodName(__METHOD__));

Classes/Authentication/OpenIdConnectToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function updateCredentials(ActionRequest $actionRequest): void
7272
*/
7373
public function extractIdentityTokenFromRequest(string $cookieName): IdentityToken
7474
{
75-
if ($this->authorizationHeader !== null) {
75+
if ($this->authorizationHeader !== null && str_contains($this->authorizationHeader, 'Bearer ')) {
7676
$identityToken = $this->extractIdentityTokenFromAuthorizationHeader($this->authorizationHeader);
7777

7878
} elseif (isset($this->queryParameters[self::OIDC_PARAMETER_NAME])) {

Classes/Command/OidcCommandController.php

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function discoverCommand(string $serviceName = null): void
5353
$this->outputLine('Use one of the following service names: ' . implode(', ', array_keys($this->settings['services'])));
5454
exit(1);
5555
}
56+
$serviceName = array_key_first($this->settings['services']);
5657
}
5758

5859
if (!isset($this->settings['services'][$serviceName])) {

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
}
2222
],
2323
"require": {
24-
"neos/flow": "^6.0 || ^7.0 || ^8.0",
24+
"php": "7.4.* || 8.0.* || 8.1.* || 8.2.*",
25+
"neos/flow": "^6.0 || ^7.0 || ^8.0 || ^9.0",
2526
"guzzlehttp/guzzle": "^6.0 || ^7.0",
2627
"flownative/oauth2-client": "^4.0.0",
2728
"phpseclib/phpseclib": "^2.0.31",

0 commit comments

Comments
 (0)