testsuite

package
v0.0.0-...-baf1828 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FakeAdminRole          = "role:admin"
	FakeAdminURL           = "/admin"
	FakeAdminAllURL        = FakeAdminURL + "*"
	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"

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

Variables

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

Functions

This section is empty.

Types

type DefaultTestTokenClaims

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

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 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