From 049622720cac38941370cdb8ee898e0122058644 Mon Sep 17 00:00:00 2001 From: Gayathri Vijayan <66356931+grvijayan@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:36:45 +0530 Subject: [PATCH] docs: update MockSAML example (#11337) # Which Problems Are Solved Update MockSAML example to work when the `Automatic creation` IDP setting is enabled. # How the Problems Are Solved By setting `IdpId` and `UserId` in `AddHumanUser.IdpLinks` returned in the `RetrieveIdentityProviderIntentResponse` response. # Additional Changes N/A # Additional Context - Related to https://github.com/zitadel/zitadel/issues/11078 - Discussion https://github.com/zitadel/zitadel/pull/11226#discussion_r2657785280 --- .../guides/integrate/identity-providers/mocksaml.mdx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/docs/guides/integrate/identity-providers/mocksaml.mdx b/docs/docs/guides/integrate/identity-providers/mocksaml.mdx index 52f1f410f..a8de7dc85 100644 --- a/docs/docs/guides/integrate/identity-providers/mocksaml.mdx +++ b/docs/docs/guides/integrate/identity-providers/mocksaml.mdx @@ -192,7 +192,6 @@ func manipulateResponse(resp *retrieveIdentityProviderIntentResponseWrapper) err if len(rawInfo.Attributes.Email) == 0 || len(rawInfo.Attributes.FirstName) == 0 || - len(rawInfo.Attributes.Id) == 0 || len(rawInfo.Attributes.LastName) == 0 { log.Println("missing required attributes in the IDP response") return nil @@ -201,7 +200,8 @@ func manipulateResponse(resp *retrieveIdentityProviderIntentResponseWrapper) err // to create a new user. if resp.AddHumanUser != nil { // set the required fields to create a new user in Zitadel based on the information returned by the IDP - resp.IdpInformation.UserName = rawInfo.Attributes.Email[0] + username := rawInfo.Attributes.Email[0] + resp.IdpInformation.UserName = username resp.AddHumanUser.Profile = &user.SetHumanProfile{ GivenName: rawInfo.Attributes.FirstName[0], @@ -211,10 +211,12 @@ func manipulateResponse(resp *retrieveIdentityProviderIntentResponseWrapper) err Email: rawInfo.Attributes.Email[0], Verification: &user.SetHumanEmail_IsVerified{IsVerified: true}, } - resp.AddHumanUser.Username = gu.Ptr(rawInfo.Attributes.Email[0]) + resp.AddHumanUser.Username = gu.Ptr(username) resp.AddHumanUser.IdpLinks = []*user.IDPLink{ { - UserName: rawInfo.Attributes.Email[0], + UserName: username, + UserId: resp.GetIdpInformation().GetUserId(), + IdpId: resp.GetIdpInformation().GetIdpId(), }, } }