mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
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
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user