Skip to content
Snippets Groups Projects
Verified Commit a55da5b9 authored by Thorsten Roßner's avatar Thorsten Roßner
Browse files

fix(context.ts): Return `null` when a required OIDC claim is not available.

parent 1d8198e6
No related branches found
No related tags found
No related merge requests found
Pipeline #68276 passed with warnings
// -----------------------------------------------------------------------------
// SPDX-FileCopyrightText: 2024 Zentrum für Digitale Souveränität der Öffentlichen Verwaltung (ZenDiS) GmbH
// SPDX-FileCopyrightText: 2023 Bundesministerium des Innern und für Heimat, PG ZenDiS "Projektgruppe für Aufbau ZenDiS"
// SPDX-License-Identifier: Apache-2.0
// -----------------------------------------------------------------------------
......@@ -9,14 +10,18 @@
// -----------------------------------------------------------------------------
export function createContext(userInfo: Record<string, unknown>) {
const context = {
user: {
id: userInfo.sub,
name: userInfo.name || userInfo.preferred_username || "",
email: userInfo.email || "",
lobby_bypass: true,
},
};
return context;
if (userInfo.opendesk_username) {
const context = {
user: {
id: userInfo.sub,
name: userInfo.name || userInfo.opendesk_username || "",
email: userInfo.email || "",
lobby_bypass: true,
},
};
return context;
}
else {
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.