Skip to content

fix: use idp variant for resource auth login page icons - #3790

Merged
oschwartz10612 merged 4 commits into
fosrl:devfrom
Bolex80:fix/resource-auth-idp-variant
Sep 21, 2026
Merged

oschwartz10612 merged 4 commits into
fosrl:devfrom
Bolex80:fix/resource-auth-idp-variant

Conversation

@Bolex80

@Bolex80 Bolex80 commented Sep 19, 2026

Copy link
Copy Markdown

Bug Description

The resource auth login page (auth/resource/[resourceGuid]) — used for per-site / custom-branded logins like "Authenticate to access [resource]" — shows the generic OIDC icon on the Google and Microsoft SSO buttons instead of their branded logos.

The main login page and the org login page were already fixed, but the resource auth page's else branch was missed.

Fixes #3631

Root Cause

src/app/auth/resource/[resourceGuid]/page.tsx, in the non-SaaS / non-org path (lines ~282-287):

const idpsRes = await priv.get<AxiosResponse<ListIdpsResponse>>("/idp");
loginIdps = idpsRes.data.data.idps.map((idp) => ({
    idpId: idp.idpId,
    name: idp.name,
    variant: idp.type   // <-- always "oidc" for OIDC-backed IdPs (Google, Azure)
})) as LoginFormIDP[];

This path passes idp.type as the icon variant. For OIDC-backed providers the brand lives in the separate idpOidcConfig.variant column ("google" / "azure"), while idp.type is always "oidc". So IdpTypeIcon always resolves to the generic /idp/openid.png.

The /idp list API already returns variant (server/routers/idp/listIdps.ts selects both type and variant). This path simply wasn't using it.

Fix

variant: idp.variant ?? idp.type

This mirrors the identical fix already applied to the main login page (src/app/auth/login/page.tsx) and the org login page (src/app/auth/org/[orgId]/page.tsx) in PR #3637 — the resource-auth page's else branch was the one place left unfixed. idp.variant is nullable in the API schema, so ?? idp.type preserves the previous fallback behavior for providers without a branded variant.

How to Verify

  1. Configure Google and Microsoft/Azure OIDC identity providers (both stored with idp.type = "oidc" but idpOidcConfig.variant = "google" / "azure").
  2. Open a Pangolin-protected resource's login page (e.g. https://<resource>/auth/login, the branded "Authenticate to access X" page).
  3. Confirm the Google button shows the multicolor Google logo and the Microsoft button shows the Azure logo instead of the generic OIDC icon.

Test Plan

  • Added regression test for this bug — N/A (existing pattern; no unit test for this mapping on main; the fix matches the already-merged approach in PR Fix: Use variant instead of type only for the Org login IDPs #3637)
  • Existing tests still pass — the change is a one-line mapping, consistent with the shipped fix for auth/login
  • Manual verification — reproduced and confirmed the identical bug on the resource auth page

Risk Assessment

Low — cosmetic-only change to which logo PNG is rendered. It does not affect authentication, redirect URLs, or IdP configuration. The fallback ?? idp.type preserves current behavior for any provider where variant is null.

oschwartz10612 and others added 4 commits September 16, 2026 09:53
Add domain validation for inference mode in resource forms
The resource auth login page (auth/resource/[resourceGuid]) loads IdPs via
the global /idp list in the non-saas/non-org path and passed idp.type as the
icon variant. Since type is always 'oidc' for OIDC-backed providers (Google,
Azure), the branded logos were never selected, showing the generic OIDC icon
instead.

Use idp.variant (with type as fallback), matching the fix already applied to
the main login page (auth/login) and org login page (auth/org/[orgId]).

Fixes fosrl#3631
@oschwartz10612

Copy link
Copy Markdown
Member

Thanks!

@oschwartz10612
oschwartz10612 merged commit b857252 into fosrl:dev Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants