mirror of
https://github.com/hanzozt/sdk-golang.git
synced 2026-10-30 14:46:37 +00:00
* fix openziti/ziti#3352 adds api session ressumption to edge_apis adds method type, ApiSession interface JSON wrapper - adds string alias type AuthMethod - adds AuthMethodEmpty as a sentinal type - adds ApiSessionJsonWrapper to allow direct (un)marshalling of ApiSession via interface - adds the ability to provide custom http client and transports - adds an inline OAuth2/OIDC rp token authentication - update redirect URI handling, ensure default uses ported value
34 lines
700 B
Go
34 lines
700 B
Go
package edge_apis
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_ApiSessionMarshalling(t *testing.T) {
|
|
|
|
t.Run("test marshalling", func(t *testing.T) {
|
|
req := require.New(t)
|
|
type testStruct struct {
|
|
ApiSession ApiSessionJsonWrapper `json:"apiSession"`
|
|
}
|
|
|
|
test := &testStruct{
|
|
ApiSession: ApiSessionJsonWrapper{
|
|
ApiSession: NewApiSessionOidc("access", "refresh"),
|
|
},
|
|
}
|
|
|
|
testJson, err := json.Marshal(test)
|
|
req.NoError(err)
|
|
|
|
testUnmarhsal := &testStruct{}
|
|
|
|
err = json.Unmarshal(testJson, testUnmarhsal)
|
|
req.NoError(err)
|
|
req.Equal(test.ApiSession.ApiSession.GetToken(), testUnmarhsal.ApiSession.ApiSession.GetToken())
|
|
})
|
|
}
|