From 2e25f2f6344d559dc7d97c0d110c12cbebada52b Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 12 Sep 2024 15:40:11 +0200 Subject: [PATCH] feat(api,front): expose the `sub` OIDC field for the frontend Useful for E2EE encryption identification. Signed-off-by: Raito Bezarius --- src/backend/core/api/serializers.py | 4 ++-- src/frontend/apps/impress/src/core/auth/api/types.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/core/api/serializers.py b/src/backend/core/api/serializers.py index 3ef1ebad4..a6e478d66 100644 --- a/src/backend/core/api/serializers.py +++ b/src/backend/core/api/serializers.py @@ -16,8 +16,8 @@ class UserSerializer(serializers.ModelSerializer): class Meta: model = models.User - fields = ["id", "email"] - read_only_fields = ["id", "email"] + fields = ["id", "sub", "email"] + read_only_fields = ["id", "sub", "email"] class BaseAccessSerializer(serializers.ModelSerializer): diff --git a/src/frontend/apps/impress/src/core/auth/api/types.ts b/src/frontend/apps/impress/src/core/auth/api/types.ts index 8c137a7a3..aac5b7888 100644 --- a/src/frontend/apps/impress/src/core/auth/api/types.ts +++ b/src/frontend/apps/impress/src/core/auth/api/types.ts @@ -2,10 +2,12 @@ * Represents user retrieved from the API. * @interface User * @property {string} id - The id of the user. + * @property {string} sub - The `sub` field of OIDC * @property {string} email - The email of the user. * @property {string} name - The name of the user. */ export interface User { id: string; + sub: string; email: string; }