3
0

Fix failing TestAuthExternalSAMLSuccess test

This commit is contained in:
Denis Arh
2022-01-22 11:46:37 +01:00
parent ef0588f365
commit 8988bf4f9c
11 changed files with 132 additions and 261 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/cortezaproject/corteza-server/system/types"
s "github.com/crewjam/saml"
"github.com/crewjam/saml/samlsp"
"github.com/golang-jwt/jwt/v4"
"github.com/steinfletcher/apitest"
"go.uber.org/zap"
)
@@ -87,20 +88,18 @@ func TestAuthExternalSAMLSuccess(t *testing.T) {
cookieTokenIDPtoSPAfterLogin = apitest.
NewCookie("token").
Value(strings.TrimSpace(string(readStaticFile("static/idp_to_sp_token.cookie"))))
may21 = func() time.Time {
tm, _ := time.Parse("2006-01-2 15:04:05", "2021-05-17 09:17:10")
return tm
}
)
s.MaxClockSkew = time.Hour
s.MaxIssueDelay = time.Hour
//jwt.TimeFunc = func() time.Time {
// tm, _ := time.Parse("2006-01-2 15:04:05", "2021-05-17 09:17:10")
// return tm
//}
s.TimeNow = func() time.Time {
tm, _ := time.Parse("2006-01-2 15:04:05", "2021-05-17 09:17:10")
return tm
}
jwt.TimeFunc = may21
s.TimeNow = may21
// first step, there is no session cookie, redirect to idp
// in this case, host from parsed metadata