diff --git a/frontend/src/lib/i18n/locales/en-US.json b/frontend/src/lib/i18n/locales/en-US.json
index 12135fe..acf2a5f 100644
--- a/frontend/src/lib/i18n/locales/en-US.json
+++ b/frontend/src/lib/i18n/locales/en-US.json
@@ -42,6 +42,7 @@
"unauthorizedTitle": "Unauthorized",
"unauthorizedResourceSubtitle": "The user with username {{username}} is not authorized to access the resource {{resource}}.",
"unaothorizedLoginSubtitle": "The user with username {{username}} is not authorized to login.",
+ "unauthorizedGroupsSubtitle": "The user with username {{username}} is not in the groups required by the resource {{resource}}.",
"unauthorizedButton": "Try again",
"untrustedRedirectTitle": "Untrusted redirect",
"untrustedRedirectSubtitle": "You are trying to redirect to a domain that does not match your configured domain ({{domain}}). Are you sure you want to continue?",
diff --git a/frontend/src/lib/i18n/locales/en.json b/frontend/src/lib/i18n/locales/en.json
index 12135fe..acf2a5f 100644
--- a/frontend/src/lib/i18n/locales/en.json
+++ b/frontend/src/lib/i18n/locales/en.json
@@ -42,6 +42,7 @@
"unauthorizedTitle": "Unauthorized",
"unauthorizedResourceSubtitle": "The user with username {{username}} is not authorized to access the resource {{resource}}.",
"unaothorizedLoginSubtitle": "The user with username {{username}} is not authorized to login.",
+ "unauthorizedGroupsSubtitle": "The user with username {{username}} is not in the groups required by the resource {{resource}}.",
"unauthorizedButton": "Try again",
"untrustedRedirectTitle": "Untrusted redirect",
"untrustedRedirectSubtitle": "You are trying to redirect to a domain that does not match your configured domain ({{domain}}). Are you sure you want to continue?",
diff --git a/frontend/src/pages/unauthorized-page.tsx b/frontend/src/pages/unauthorized-page.tsx
index 6825bd2..bcb3590 100644
--- a/frontend/src/pages/unauthorized-page.tsx
+++ b/frontend/src/pages/unauthorized-page.tsx
@@ -3,11 +3,13 @@ import { Layout } from "../components/layouts/layout";
import { Navigate } from "react-router";
import { isQueryValid } from "../utils/utils";
import { Trans, useTranslation } from "react-i18next";
+import React from "react";
export const UnauthorizedPage = () => {
const queryString = window.location.search;
const params = new URLSearchParams(queryString);
const username = params.get("username") ?? "";
+ const groupErr = params.get("groupErr") ?? "";
const resource = params.get("resource") ?? "";
const { t } = useTranslation();
@@ -16,6 +18,47 @@ export const UnauthorizedPage = () => {
return ;
}
+ if (isQueryValid(resource) && !isQueryValid(groupErr)) {
+ return (
+
+ }}
+ values={{ resource, username }}
+ />
+
+ );
+ }
+
+ if (isQueryValid(groupErr) && isQueryValid(resource)) {
+ return (
+
+ }}
+ values={{ username, resource }}
+ />
+
+ )
+ }
+
+ return (
+
+ }}
+ values={{ username }}
+ />
+
+ );
+};
+
+const UnauthorizedLayout = ({ children }: { children: React.ReactNode }) => {
+ const { t } = useTranslation();
+
return (
@@ -23,25 +66,7 @@ export const UnauthorizedPage = () => {
{t("Unauthorized")}
- {isQueryValid(resource) ? (
-
- }}
- values={{ resource, username }}
- />
-
- ) : (
-
- }}
- values={{ username }}
- />
-
- )}
+ {children}