mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-23 05:18:46 +00:00
feat(login): Sign in with Zitadel (#12530)
Closes #11824 # Which Problems Are Solved The backend supports the dedicated ZITADEL identity provider template (`AddZitadelProvider`, `IDENTITY_PROVIDER_TYPE_ZITADEL`), but the new login (login v2) cannot yet handle providers of this type: A configured and activated ZITADEL IdP is not rendered as a sign-in option, because the provider type is missing from the login's component mapping. # How the Problems Are Solved - Regenerated `@zitadel/proto` (`settings/v2/login_settings_pb` in `types`, `es` and `cjs`) so `IdentityProviderType.ZITADEL = 13` is available (`idp/v2` was already up to date). - `apps/login/src/lib/idp.ts`: - `idpTypeToSlug` maps `ZITADEL` to the `zitadel` slug, used by the generic `/idp/[provider]/process|failure` routes (no route changes needed). - `idpTypeToIdentityProviderType` maps `IDPType.IDP_TYPE_ZITADEL` to `IdentityProviderType.ZITADEL`. - Added `SignInWithZitadel` button (`apps/login/src/components/idps/sign-in-with-zitadel.tsx`) with the Zitadel logo as inline SVG: the brand gradient is theme-independent, accents use `currentColor` to adapt to light/dark, consistent with the other provider buttons. - Registered the Zitadel type in the provider-to-component mapping in `sign-in-with-idp.tsx`. No changes to the IdP intent handling are required: user auto-creation/auto-update consume the pre-mapped `user_action.create_user` / `update_user` from `RetrieveIdentityProviderIntent`, which the backend fills for the Zitadel provider like for any generic OIDC provider. # Additional Changes - Added the `signInWithZitadel` i18n key ("Sign in with Zitadel") to all 15 locale files. - Extended `idp.test.ts` with the new slug and type mappings and added the Zitadel type to the exhaustive enum-coverage tests (45 tests passing). # Additional Context - Part of the "Zitadel as an Identity Provider" epic: #5127 - Enables the customer-portal "support access" flow, where support staff sign in to a customer instance via a pre-configured Zitadel Support IdP --------- Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI
parent
83854e80e0
commit
30434d176c
@@ -65,6 +65,11 @@ describe("idp type mapping utilities", () => {
|
||||
expect(result).toBe("jwt");
|
||||
});
|
||||
|
||||
it("should map ZITADEL to 'zitadel'", () => {
|
||||
const result = idpTypeToSlug(IdentityProviderType.ZITADEL);
|
||||
expect(result).toBe("zitadel");
|
||||
});
|
||||
|
||||
it("should throw error for unknown identity provider type", () => {
|
||||
// Using a value that doesn't match any known type
|
||||
const unknownType = 9999 as IdentityProviderType;
|
||||
@@ -92,6 +97,7 @@ describe("idp type mapping utilities", () => {
|
||||
IdentityProviderType.OIDC,
|
||||
IdentityProviderType.LDAP,
|
||||
IdentityProviderType.JWT,
|
||||
IdentityProviderType.ZITADEL,
|
||||
];
|
||||
|
||||
handledTypes.forEach((type) => {
|
||||
@@ -178,6 +184,11 @@ describe("idp type mapping utilities", () => {
|
||||
expect(result).toBe(IdentityProviderType.JWT);
|
||||
});
|
||||
|
||||
it("should map IDP_TYPE_ZITADEL to ZITADEL", () => {
|
||||
const result = idpTypeToIdentityProviderType(IDPType.IDP_TYPE_ZITADEL);
|
||||
expect(result).toBe(IdentityProviderType.ZITADEL);
|
||||
});
|
||||
|
||||
it("should throw error for unknown IDP type", () => {
|
||||
// Using a value that doesn't match any known type
|
||||
const unknownType = 9999 as IDPType;
|
||||
@@ -203,6 +214,7 @@ describe("idp type mapping utilities", () => {
|
||||
IDPType.IDP_TYPE_OAUTH,
|
||||
IDPType.IDP_TYPE_OIDC,
|
||||
IDPType.IDP_TYPE_JWT,
|
||||
IDPType.IDP_TYPE_ZITADEL,
|
||||
];
|
||||
|
||||
handledTypes.forEach((type) => {
|
||||
@@ -310,6 +322,7 @@ describe("idp type mapping utilities", () => {
|
||||
IdentityProviderType.OAUTH,
|
||||
IdentityProviderType.LDAP,
|
||||
IdentityProviderType.JWT,
|
||||
IdentityProviderType.ZITADEL,
|
||||
];
|
||||
|
||||
const slugs = types.map((type) => idpTypeToSlug(type));
|
||||
|
||||
@@ -28,6 +28,8 @@ export function idpTypeToSlug(idpType: IdentityProviderType) {
|
||||
return "ldap";
|
||||
case IdentityProviderType.JWT:
|
||||
return "jwt";
|
||||
case IdentityProviderType.ZITADEL:
|
||||
return "zitadel";
|
||||
default:
|
||||
throw new Error("Unknown identity provider type");
|
||||
}
|
||||
@@ -69,6 +71,9 @@ export function idpTypeToIdentityProviderType(idpType: IDPType): IdentityProvide
|
||||
case IDPType.IDP_TYPE_JWT:
|
||||
return IdentityProviderType.JWT;
|
||||
|
||||
case IDPType.IDP_TYPE_ZITADEL:
|
||||
return IdentityProviderType.ZITADEL;
|
||||
|
||||
default:
|
||||
throw new Error("Unknown identity provider type");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user