mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
* adds posture cache, instance, instance data, and event hooks - reworks router security - abstracts api session and service sessions - use connection tracker instead of various maps - doc - adds service sessions as always JWTs - addes token logging fields - removes multiple connection tracking fields - adds support for router specific posture data/respones - adds support for router posture check evaluation - defer dial/bind posture checking for legacy to controller - fix double session event emitting - fix session event missing id
38 lines
1007 B
Go
38 lines
1007 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/openziti/sdk-golang/ziti"
|
|
"github.com/openziti/ziti/common/eid"
|
|
)
|
|
|
|
func Test_SDK_API_Session_Token_Update(t *testing.T) {
|
|
ctx := NewTestContext(t)
|
|
defer ctx.Teardown()
|
|
ctx.StartServer()
|
|
ctx.RequireAdminManagementApiLogin()
|
|
ctx.CreateEnrollAndStartEdgeRouter()
|
|
|
|
ctx.AdminManagementSession.requireNewEdgeRouterPolicy(s("#all"), s("#all"))
|
|
ctx.AdminManagementSession.requireNewServiceEdgeRouterPolicy(s("#all"), s("#all"))
|
|
|
|
sdkRole := eid.New()
|
|
_, hostContextIface := ctx.AdminManagementSession.RequireCreateSdkContext(sdkRole)
|
|
defer hostContextIface.Close()
|
|
|
|
sdkContext, ok := hostContextIface.(*ziti.ContextImpl)
|
|
ctx.Req.True(ok, "sdkContext should be of type *ziti.ContextImpl")
|
|
ctx.Req.NotNil(sdkContext)
|
|
|
|
err := sdkContext.Authenticate()
|
|
ctx.Req.NoError(err)
|
|
|
|
err = sdkContext.ConnectAllAvailableErs()
|
|
ctx.Req.NoError(err)
|
|
|
|
functionalErr, erErr := sdkContext.RefreshApiSession()
|
|
ctx.Req.NoError(functionalErr)
|
|
ctx.Req.NoError(erErr)
|
|
}
|