test_helper

package
v0.0.0-...-049ef2a Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormValueRequestWithJSONResponse

func FormValueRequestWithJSONResponse(t *testing.T, server *httptest.Server, method string, values, requestHeaders map[string]string,
	code int, responseHeaders map[string]Matcher) map[string]interface{}

func GetFormValueRequestWithJSONResponse

func GetFormValueRequestWithJSONResponse(t *testing.T, server *httptest.Server, values, requestHeaders map[string]string,
	code int, responseHeaders map[string]Matcher) map[string]interface{}

func PostFormValueRequestWithJSONResponse

func PostFormValueRequestWithJSONResponse(t *testing.T, server *httptest.Server, values, requestHeaders map[string]string,
	code int, responseHeaders map[string]Matcher) map[string]interface{}

func ProtectedResourceErrorTest

func ProtectedResourceErrorTest(t *testing.T, server *httptest.Server, method string, values, requestHeaders map[string]string, code int, responseHeaders map[string]Matcher)

func ProtectedResourceSuccessTest

func ProtectedResourceSuccessTest(t *testing.T, server *httptest.Server, method string, values, requestHeaders map[string]string, code int, responseHeaders, responseValues map[string]Matcher)

func TokenEndpointErrorTest

func TokenEndpointErrorTest(t *testing.T, server *httptest.Server, values, requestHeaders map[string]string,
	code int, responseHeaders, errors map[string]Matcher)

func TokenEndpointSuccessTest

func TokenEndpointSuccessTest(t *testing.T, server *httptest.Server, values, requestHeaders map[string]string,
	code int, responseHeaders, responseValues, idTokenValues map[string]Matcher)

Types

type AbsentMatcher

type AbsentMatcher struct {
}

func NewAbsentMatcher

func NewAbsentMatcher() *AbsentMatcher

func (*AbsentMatcher) Match

func (m *AbsentMatcher) Match(v interface{}) bool

func (*AbsentMatcher) RequireAbsent

func (m *AbsentMatcher) RequireAbsent() bool

func (*AbsentMatcher) WantValue

func (m *AbsentMatcher) WantValue() string

type Int64Matcher

type Int64Matcher struct {
	// contains filtered or unexported fields
}

func NewInt64Matcher

func NewInt64Matcher(v int64) *Int64Matcher

func (*Int64Matcher) Match

func (m *Int64Matcher) Match(v interface{}) bool

func (*Int64Matcher) RequireAbsent

func (m *Int64Matcher) RequireAbsent() bool

func (*Int64Matcher) WantValue

func (m *Int64Matcher) WantValue() string

type Int64RangeMatcher

type Int64RangeMatcher struct {
	// contains filtered or unexported fields
}

func NewInt64RangeMatcher

func NewInt64RangeMatcher(from, to int64) *Int64RangeMatcher

func (*Int64RangeMatcher) Match

func (m *Int64RangeMatcher) Match(v interface{}) bool

func (*Int64RangeMatcher) RequireAbsent

func (m *Int64RangeMatcher) RequireAbsent() bool

func (*Int64RangeMatcher) WantValue

func (m *Int64RangeMatcher) WantValue() string

type Matcher

type Matcher interface {
	RequireAbsent() bool
	Match(v interface{}) bool
	WantValue() string
}

type RegexMatcher

type RegexMatcher struct {
	// contains filtered or unexported fields
}

func NewRegexMatcher

func NewRegexMatcher(v string) *RegexMatcher

func (*RegexMatcher) Match

func (m *RegexMatcher) Match(v interface{}) bool

func (*RegexMatcher) RequireAbsent

func (m *RegexMatcher) RequireAbsent() bool

func (*RegexMatcher) WantValue

func (m *RegexMatcher) WantValue() string

type StrMatcher

type StrMatcher struct {
	// contains filtered or unexported fields
}

func NewStrMatcher

func NewStrMatcher(v string) *StrMatcher

func (*StrMatcher) Match

func (m *StrMatcher) Match(v interface{}) bool

func (*StrMatcher) RequireAbsent

func (m *StrMatcher) RequireAbsent() bool

func (*StrMatcher) WantValue

func (m *StrMatcher) WantValue() string

type TestAuthInfo

type TestAuthInfo struct {
	Enabled bool
	// contains filtered or unexported fields
}

func (*TestAuthInfo) GetAuthorizedAt

func (i *TestAuthInfo) GetAuthorizedAt() int64

func (*TestAuthInfo) GetClientId

func (i *TestAuthInfo) GetClientId() string

func (*TestAuthInfo) GetId

func (i *TestAuthInfo) GetId() int64

func (*TestAuthInfo) GetScope

func (i *TestAuthInfo) GetScope() string

func (*TestAuthInfo) GetSubject

func (i *TestAuthInfo) GetSubject() string

func (*TestAuthInfo) GetUserId

func (i *TestAuthInfo) GetUserId() int64

func (*TestAuthInfo) IsActive

func (i *TestAuthInfo) IsActive() bool

type TestAuthSession

type TestAuthSession struct {
	Enabled bool
	// contains filtered or unexported fields
}

func (*TestAuthSession) GetAuthId

func (s *TestAuthSession) GetAuthId() int64

func (*TestAuthSession) GetAuthTime

func (s *TestAuthSession) GetAuthTime() int64

func (*TestAuthSession) GetCode

func (s *TestAuthSession) GetCode() string

func (*TestAuthSession) GetCodeVerifier

func (s *TestAuthSession) GetCodeVerifier() string

func (*TestAuthSession) GetCreatedAt

func (s *TestAuthSession) GetCreatedAt() int64

func (*TestAuthSession) GetExpiresIn

func (s *TestAuthSession) GetExpiresIn() int64

func (*TestAuthSession) GetIdTokenExpiresIn

func (s *TestAuthSession) GetIdTokenExpiresIn() int64

func (*TestAuthSession) GetNonce

func (s *TestAuthSession) GetNonce() string

func (*TestAuthSession) GetRedirectURI

func (s *TestAuthSession) GetRedirectURI() string

type TestClient

type TestClient struct {
	Enabled bool
	// contains filtered or unexported fields
}

func NewTestClient

func NewTestClient(ownerId int64, id, secret, redirectURI, alg string, key interface{}, keyId string) *TestClient

func (*TestClient) AllowToUseGrantType

func (c *TestClient) AllowToUseGrantType(gt string)

func (*TestClient) CanUseFlow

func (c *TestClient) CanUseFlow(flowType flow.FlowType) bool

func (*TestClient) CanUseGrantType

func (c *TestClient) CanUseGrantType(gt string) bool

func (*TestClient) CanUseRedirectURI

func (c *TestClient) CanUseRedirectURI(url string) bool

func (*TestClient) CanUseScope

func (c *TestClient) CanUseScope(flowType flow.FlowType, scope string) bool

func (*TestClient) GetAssertionKey

func (c *TestClient) GetAssertionKey(alg, kid string) interface{}

func (*TestClient) GetId

func (c *TestClient) GetId() string

func (*TestClient) GetIdTokenAlg

func (c *TestClient) GetIdTokenAlg() string

func (*TestClient) GetIdTokenKey

func (c *TestClient) GetIdTokenKey() interface{}

func (*TestClient) GetIdTokenKeyId

func (c *TestClient) GetIdTokenKeyId() string

func (*TestClient) GetNoConsentPromptPolicy

func (c *TestClient) GetNoConsentPromptPolicy() prompt.NoConsentPromptPolicy

func (*TestClient) GetNonePromptPolicy

func (c *TestClient) GetNonePromptPolicy() prompt.NonePromptPolicy

func (*TestClient) GetOwnerUserId

func (c *TestClient) GetOwnerUserId() int64

func (*TestClient) MatchSecret

func (c *TestClient) MatchSecret(secret string) bool

type TestOAuthToken

type TestOAuthToken struct {
	// contains filtered or unexported fields
}

func NewTestOAuthToken

func NewTestOAuthToken(authId int64, accessToken string, accessTokenExpiresIn, refreshedAt int64,
	refreshToken string, refreshTokenExpiresIn, createdAt int64) *TestOAuthToken

func (*TestOAuthToken) GetAccessToken

func (t *TestOAuthToken) GetAccessToken() string

func (*TestOAuthToken) GetAccessTokenExpiresIn

func (t *TestOAuthToken) GetAccessTokenExpiresIn() int64

func (*TestOAuthToken) GetAuthId

func (t *TestOAuthToken) GetAuthId() int64

func (*TestOAuthToken) GetCreatedAt

func (t *TestOAuthToken) GetCreatedAt() int64

func (*TestOAuthToken) GetRefreshToken

func (t *TestOAuthToken) GetRefreshToken() string

func (*TestOAuthToken) GetRefreshTokenExpiresIn

func (t *TestOAuthToken) GetRefreshTokenExpiresIn() int64

func (*TestOAuthToken) GetRefreshedAt

func (t *TestOAuthToken) GetRefreshedAt() int64

type TestStore

type TestStore struct {
	// contains filtered or unexported fields
}

func NewTestStore

func NewTestStore() *TestStore

func (*TestStore) ClearAll

func (s *TestStore) ClearAll()

func (*TestStore) ClearAuthData

func (s *TestStore) ClearAuthData()

func (*TestStore) CreateAuthSession

func (s *TestStore) CreateAuthSession(info bridge.AuthInfo, session *authorization.Session) *bridge.Error

func (*TestStore) CreateNewClient

func (s *TestStore) CreateNewClient(ownerId int64, id, secret, redirectURI string) *TestClient

func (*TestStore) CreateNewUser

func (s *TestStore) CreateNewUser(name, pass string) *TestUser

func (*TestStore) CreateOAuthToken

func (s *TestStore) CreateOAuthToken(info bridge.AuthInfo, onTokenEndpoint bool) (bridge.OAuthToken, *bridge.Error)

func (*TestStore) CreateOrUpdateAuthInfo

func (s *TestStore) CreateOrUpdateAuthInfo(uid int64, clientId, scope string) (bridge.AuthInfo, *bridge.Error)

func (*TestStore) DisableSession

func (s *TestStore) DisableSession(sess bridge.AuthSession) *bridge.Error

func (*TestStore) FindActiveAuthInfoById

func (s *TestStore) FindActiveAuthInfoById(id int64) (bridge.AuthInfo, *bridge.Error)

func (*TestStore) FindAuthInfoByUserIdAndClientId

func (s *TestStore) FindAuthInfoByUserIdAndClientId(uid int64, cid string) (bridge.AuthInfo, *bridge.Error)

func (*TestStore) FindAuthSessionByCode

func (s *TestStore) FindAuthSessionByCode(code string) (bridge.AuthSession, *bridge.Error)

func (*TestStore) FindClientById

func (s *TestStore) FindClientById(cid string) (bridge.Client, *bridge.Error)

func (*TestStore) FindOAuthTokenByAccessToken

func (s *TestStore) FindOAuthTokenByAccessToken(token string) (bridge.OAuthToken, *bridge.Error)

func (*TestStore) FindOAuthTokenByRefreshToken

func (s *TestStore) FindOAuthTokenByRefreshToken(token string) (bridge.OAuthToken, *bridge.Error)

func (*TestStore) FindUserId

func (s *TestStore) FindUserId(username, password string) (int64, *bridge.Error)

func (*TestStore) FindUserIdBySubject

func (s *TestStore) FindUserIdBySubject(sub string) (int64, *bridge.Error)

func (*TestStore) Issuer

func (s *TestStore) Issuer() string

DataInterface

func (*TestStore) RecordAssertionClaims

func (s *TestStore) RecordAssertionClaims(sub, jti string, iat, exp int64) *bridge.Error

func (*TestStore) RefreshAccessToken

func (s *TestStore) RefreshAccessToken(info bridge.AuthInfo, old bridge.OAuthToken) (bridge.OAuthToken, *bridge.Error)

type TestUser

type TestUser struct {
	Id       int64
	Username string
	Password string
}

Jump to

Keyboard shortcuts

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