Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next' into feature-zms-3499-auto…
Browse files Browse the repository at this point in the history
…-refresh-queue
  • Loading branch information
MoDaae committed Feb 4, 2025
2 parents 2e48f50 + ee28a78 commit cdbcd5b
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 131 deletions.
3 changes: 2 additions & 1 deletion zmsadmin/templates/block/emergency/emergency.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
data-state="clear"
data-source="">
<h2 class="aural">Notruf</h2>
{% if workstation.name %}
<button class="button button--emergency emergency__button-trigger" >
<i class="fas fa-bell" aria-hidden="true"></i> NOTRUF
</button>

{% endif %}
<div class="emergency__overlay">
<div class="block emergency__overlay-layout" role="dialog" aria-labelledby="emergency__overlay_title">
{% embed "block/scaffholding/board.twig" with {'class': "emergency__display-box"} %} {# do NOT use class exception here! #}
Expand Down
6 changes: 2 additions & 4 deletions zmsadmin/templates/block/process/info.twig
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@
</dl>
<a class="button button--positive button--fullwidth button-finish right" href="{{ urlGet("workstationProcessFinished", {}, {}) }}" style="margin: 0.5em 0;">Fertig stellen</a>

{% if workstation.process.withAppointment %}
<a class="button button--default button--fullwidth button-finish right" href="{{ urlGet("workstationProcessRedirect", {}, {}) }}" style="margin: 0.5em 0;">Weiterleiten</a>
{% endif %}
<button
<a class="button button--default button--fullwidth button-finish right" href="{{ urlGet("workstationProcessRedirect", {}, {}) }}" style="margin: 0.5em 0;">Weiterleiten</a>
<button
type="button"
class="button button--fullwidth client-called_button-parked left"
style="margin: 0.5em 0; background-color: #edc00f; border-color: #edc00f !important;"
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/ProcessRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function readResponse(
$newProcess = (new \BO\Zmsdb\Process())->redirectToScope(
$newProcess,
$process->scope,
$process->id,
$process->queue['number'] ?? $process->id,
$workstation->getUseraccount()
);

Expand Down
6 changes: 3 additions & 3 deletions zmscalldisplay/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 16 additions & 11 deletions zmsslim/src/Slim/Middleware/OAuth/KeycloakInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ private function testAccess(AccessToken $token)
'event' => 'oauth_token_validation',
'timestamp' => date('c')
]);

list($header, $payload, $signature) = explode('.', $token->getToken());

if (empty($header)) {
$this->logger->error('Token validation failed', [
'event' => 'oauth_token_validation_failed',
Expand All @@ -128,11 +128,16 @@ private function testAccess(AccessToken $token)
]);
throw new \BO\Slim\Exception\OAuthFailed();
}

$realmData = $this->provider->getBasicOptionsFromJsonFile();
$accessTokenPayload = json_decode(base64_decode($payload), true);

// Fix: Properly handle base64url encoding before JSON decoding
$payload = str_replace(['-', '_'], ['+', '/'], $payload);
$payload = base64_decode($payload . str_repeat('=', 4 - (strlen($payload) % 4)));
$accessTokenPayload = json_decode($payload, true);

$clientRoles = array();

if ($accessTokenPayload === null) {
$this->logger->error('Token validation failed', [
'event' => 'oauth_token_validation_failed',
Expand All @@ -142,7 +147,7 @@ private function testAccess(AccessToken $token)
]);
throw new \BO\Slim\Exception\OAuthFailed();
}

if (!isset($accessTokenPayload['resource_access']) || !is_array($accessTokenPayload['resource_access'])) {
$this->logger->error('Token validation failed', [
'event' => 'oauth_token_validation_failed',
Expand All @@ -153,7 +158,7 @@ private function testAccess(AccessToken $token)
]);
throw new \BO\Slim\Exception\OAuthFailed();
}

if (!isset($accessTokenPayload['resource_access'][\App::IDENTIFIER])) {
$this->logger->error('Token validation failed', [
'event' => 'oauth_token_validation_failed',
Expand All @@ -164,10 +169,10 @@ private function testAccess(AccessToken $token)
]);
throw new \BO\Slim\Exception\OAuthFailed();
}

$resourceAccess = $accessTokenPayload['resource_access'];
$appIdentifierRoles = $resourceAccess[\App::IDENTIFIER]['roles'] ?? null;

if (!$appIdentifierRoles || !is_array($appIdentifierRoles)) {
$this->logger->error('Token validation failed', [
'event' => 'oauth_token_validation_failed',
Expand All @@ -178,7 +183,7 @@ private function testAccess(AccessToken $token)
]);
throw new \BO\Slim\Exception\OAuthFailed();
}

if (is_array($accessTokenPayload['resource_access'])) {
$clientRoles = array_values($accessTokenPayload['resource_access'][\App::IDENTIFIER]['roles']);
}
Expand All @@ -193,7 +198,7 @@ private function testAccess(AccessToken $token)
]);
throw new \BO\Slim\Exception\OAuthFailed();
}

\App::$log->info('Token validation successful', [
'event' => 'oauth_token_validation_success',
'timestamp' => date('c')
Expand Down
Loading

0 comments on commit cdbcd5b

Please sign in to comment.