From 565ac73475bd994ac7d39d8978c8bfb7889293d2 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Tue, 6 Jan 2026 08:40:16 +0100 Subject: [PATCH] test: fix SAML IdP unit tests (#11270) # Which Problems Are Solved Similar to https://github.com/zitadel/zitadel/pull/11241, there are additional unit tests where certificates expired. # How the Problems Are Solved The tests use dedicated combinations of SAML metadata, certificates and responses and also already use the `TimeNow` function from the `crewjam/saml` package to overwrite necessary time validations. This PR now additionally sets the `Clock` variable in the same package, which is used in XML validations like the signing. # Additional Changes None # Additional Context - relates to #11241 - requires backport to at least v4.x --- internal/idp/providers/saml/session_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/idp/providers/saml/session_test.go b/internal/idp/providers/saml/session_test.go index 836462c5d..18859fa69 100644 --- a/internal/idp/providers/saml/session_test.go +++ b/internal/idp/providers/saml/session_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/crewjam/saml" + dsig "github.com/russellhaering/goxmldsig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -377,6 +378,7 @@ func TestSession_FetchUser(t *testing.T) { // set to time of response for validation saml.TimeNow = tt.fields.timeNow + saml.Clock = dsig.NewFakeClockAt(tt.fields.timeNow()) user, err := session.FetchUser(context.Background()) if tt.want.err != nil && !errors.Is(err, tt.want.err) {