testsuite_test

package
v0.0.0-...-33cbe1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeAdminRole          = "role:admin"
	FakeAdminURL           = "/admin"
	FakeAdminAllURL        = FakeAdminURL + "*"
	FakeAdminTestURL       = "/auth_all/test"
	FakeAuthAllURL         = "/auth_all/*"
	FakeClientID           = "test"
	FakeSecret             = "test"
	FakeTestAdminRolesURL  = "/test_admin_roles"
	FakeTestRole           = "role:test"
	FakeTestURL            = "/test"
	FakeTestRoleURL        = "/test_role"
	FakeTestWhitelistedURL = "/auth_all/white_listed*"
	TestProxyAccepted      = "Proxy-Accepted"
	ValidUsername          = "test"
	ValidPassword          = "test"
	TestEncryptionKey      = "ZSeCYDUxIlhDrmPpa1Ldc7il384esSF2"

	FakeSignature                   = ".SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
	FakeCertFilePrefix              = "/gateadmin_crt_"
	FakePrivFilePrefix              = "/gateadmin_priv_"
	FakeCaFilePrefix                = "/gateadmin_ca_"
	FakeCaKeyFilePrefix             = "/gateadmin_ca_priv_"
	TestProxyHeaderKey              = "X-GoProxy"
	TestSetCookieHeader             = "Set-Cookie"
	TestProxyHeaderVal              = "yxorPoG-X"
	DefaultOpenIDProviderTimeout    = time.Second * 5
	DefaultOpenIDProviderRetryCount = 3
	DefaultIat                      = 1450372669
	OAuthCodeLength                 = 32
)

Variables

View Source
var (
	ErrCreateFakeProxy = errors.New("failed to create fake proxy service")
	ErrRunHTTPServer   = errors.New("failed to run http server")
	ErrShutHTTPServer  = errors.New("failed to shutdown http server")
)

Functions

This section is empty.

Types

type DefaultTestTokenClaims

type DefaultTestTokenClaims struct {
	ResourceAccess    map[string]RoleClaim `json:"resource_access"`
	FamilyName        string               `json:"family_name"`
	Name              string               `json:"name"`
	Email             string               `json:"email"`
	Aud               string               `json:"aud"`
	GivenName         string               `json:"given_name"`
	Username          string               `json:"username"`
	ClientSession     string               `json:"client_session"`
	Found             string               `json:"found"`
	Jti               string               `json:"jti"`
	Iss               string               `json:"iss"`
	Item              string               `json:"item"`
	Azp               string               `json:"azp"`
	PreferredUsername string               `json:"preferred_username"`
	SessionState      string               `json:"session_state"`
	Sub               string               `json:"sub"`
	Typ               string               `json:"typ"`
	RealmAccess       RoleClaim            `json:"realm_access"`
	Groups            []string             `json:"groups"`
	Item1             []string             `json:"item1"`
	Item2             []string             `json:"item2"`
	Item3             []string             `json:"item3"`
	Authorization     models.Permissions   `json:"authorization"`
	Exp               int64                `json:"exp"`
	Nbf               int                  `json:"nbf"`
	Iat               int64                `json:"iat"`
}

type FakeToken

type FakeToken struct {
	Claims DefaultTestTokenClaims
}

func NewTestToken

func NewTestToken(issuer string) *FakeToken

func (*FakeToken) GetToken

func (t *FakeToken) GetToken() (string, error)

func (*FakeToken) GetUnsignedToken

func (t *FakeToken) GetUnsignedToken() (string, error)

func (*FakeToken) SetExpiration

func (t *FakeToken) SetExpiration(tm time.Time)

type FakeUpstreamResponse

type FakeUpstreamResponse struct {
	URI     string      `json:"uri"`
	Method  string      `json:"method"`
	Address string      `json:"address"`
	Headers http.Header `json:"headers"`
	Body    string      `json:"body"`
}

FakeUpstreamResponse is the response from fake upstream.

type FakeUpstreamService

type FakeUpstreamService struct{}

FakeUpstreamService acts as a fake upstream service, returns the headers and request.

func (*FakeUpstreamService) ServeHTTP

func (f *FakeUpstreamService) ServeHTTP(wrt http.ResponseWriter, req *http.Request)

type RoleClaim

type RoleClaim struct {
	Roles []string `json:"roles"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL