feat(web): auth provider section in settings page (GRO-391)
feat(web): auth provider section in settings page (GRO-391)
This commit was merged in pull request #216.
This commit is contained in:
@@ -124,10 +124,8 @@ authProviderRouter.put(
|
|||||||
// ─── POST /api/admin/auth-provider/test ─────────────────────────────────────
|
// ─── POST /api/admin/auth-provider/test ─────────────────────────────────────
|
||||||
|
|
||||||
const testAuthProviderSchema = z.object({
|
const testAuthProviderSchema = z.object({
|
||||||
providerId: z.string().min(1).max(100),
|
|
||||||
issuerUrl: z.string().url(),
|
issuerUrl: z.string().url(),
|
||||||
clientId: z.string().min(1),
|
internalBaseUrl: z.string().url().nullable().optional(),
|
||||||
clientSecret: z.string().min(1),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
authProviderRouter.post(
|
authProviderRouter.post(
|
||||||
@@ -135,10 +133,12 @@ authProviderRouter.post(
|
|||||||
requireSuperUser(),
|
requireSuperUser(),
|
||||||
zValidator("json", testAuthProviderSchema),
|
zValidator("json", testAuthProviderSchema),
|
||||||
async (c) => {
|
async (c) => {
|
||||||
const { issuerUrl } = c.req.valid("json");
|
const { issuerUrl, internalBaseUrl } = c.req.valid("json");
|
||||||
|
|
||||||
// Fetch OIDC discovery document
|
// Fetch OIDC discovery document
|
||||||
const discoveryUrl = `${issuerUrl.replace(/\/$/, "")}/.well-known/openid-configuration`;
|
const discoveryUrl = internalBaseUrl
|
||||||
|
? `${internalBaseUrl.replace(/\/$/, "")}/application/o/.well-known/openid-configuration`
|
||||||
|
: `${issuerUrl.replace(/\/$/, "")}/.well-known/openid-configuration`;
|
||||||
|
|
||||||
let metadata: Record<string, unknown> | null = null;
|
let metadata: Record<string, unknown> | null = null;
|
||||||
let errorMessage: string | null = null;
|
let errorMessage: string | null = null;
|
||||||
|
|||||||
@@ -235,9 +235,8 @@ export function SettingsPage() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
providerId: authForm.providerId,
|
issuerUrl: authForm.issuerUrl,
|
||||||
issuerUrl: authForm.issuerUrl,
|
...(authForm.internalBaseUrl ? { internalBaseUrl: authForm.internalBaseUrl } : {}),
|
||||||
clientId: authForm.clientId,
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user