testhelpers

package
v0.0.0-...-f7bec94 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestLifespans = client.UpdateOAuth2ClientLifespans{
	AuthorizationCodeGrantAccessTokenLifespan:  x.NullDuration{Duration: 31 * time.Hour, Valid: true},
	AuthorizationCodeGrantIDTokenLifespan:      x.NullDuration{Duration: 32 * time.Hour, Valid: true},
	AuthorizationCodeGrantRefreshTokenLifespan: x.NullDuration{Duration: 33 * time.Hour, Valid: true},
	ClientCredentialsGrantAccessTokenLifespan:  x.NullDuration{Duration: 34 * time.Hour, Valid: true},
	ImplicitGrantAccessTokenLifespan:           x.NullDuration{Duration: 35 * time.Hour, Valid: true},
	ImplicitGrantIDTokenLifespan:               x.NullDuration{Duration: 36 * time.Hour, Valid: true},
	JwtBearerGrantAccessTokenLifespan:          x.NullDuration{Duration: 37 * time.Hour, Valid: true},
	PasswordGrantAccessTokenLifespan:           x.NullDuration{Duration: 38 * time.Hour, Valid: true},
	PasswordGrantRefreshTokenLifespan:          x.NullDuration{Duration: 39 * time.Hour, Valid: true},
	RefreshTokenGrantIDTokenLifespan:           x.NullDuration{Duration: 40 * time.Hour, Valid: true},
	RefreshTokenGrantAccessTokenLifespan:       x.NullDuration{Duration: 41 * time.Hour, Valid: true},
	RefreshTokenGrantRefreshTokenLifespan:      x.NullDuration{Duration: 42 * time.Hour, Valid: true},
}

Functions

func DecodeIDToken

func DecodeIDToken(t *testing.T, token *oauth2.Token) gjson.Result

func FlexibleServer

func FlexibleServer(t *testing.T, h *http.HandlerFunc) string

func HTTPServerNoExpectedCallHandler

func HTTPServerNoExpectedCallHandler(t *testing.T) http.HandlerFunc

func HTTPServerNotImplementedHandler

func HTTPServerNotImplementedHandler(w http.ResponseWriter, _ *http.Request)

func IntrospectToken

func IntrospectToken(t *testing.T, conf *oauth2.Config, token string, adminTS *httptest.Server) gjson.Result

func JanitorTests

func JanitorTests(conf *config.Provider, consentManager consent.Manager, clientManager client.Manager, fositeManager x.FositeStorer) func(t *testing.T)

func NewCallbackURL

func NewCallbackURL(t *testing.T, prefix string, h http.HandlerFunc) string

func NewEmptyCookieJar

func NewEmptyCookieJar(t *testing.T) *cookiejar.Jar

func NewEmptyJarClient

func NewEmptyJarClient(t *testing.T) *http.Client

func NewIDToken

func NewIDToken(t *testing.T, reg driver.Registry, subject string) string

func NewIDTokenWithClaims

func NewIDTokenWithClaims(t *testing.T, reg driver.Registry, claims djwt.MapClaims) string

func NewIDTokenWithExpiry

func NewIDTokenWithExpiry(t *testing.T, reg driver.Registry, subject string, exp time.Duration) string

func NewLoginConsentUI

func NewLoginConsentUI(t *testing.T, c *config.Provider, login, consent http.HandlerFunc)

func NewOAuth2Server

func NewOAuth2Server(t *testing.T, reg driver.Registry) (publicTS, adminTS *httptest.Server)

func RequireEqualDuration

func RequireEqualDuration(t *testing.T, expected time.Duration, actual time.Duration, precision time.Duration)

func RequireEqualTime

func RequireEqualTime(t *testing.T, expected time.Time, actual time.Time, precision time.Duration)

func UpdateClientTokenLifespans

func UpdateClientTokenLifespans(t *testing.T, conf *oauth2.Config, clientID string, lifespans client.UpdateOAuth2ClientLifespans, adminTS *httptest.Server)

func Userinfo

func Userinfo(t *testing.T, token *oauth2.Token, publicTS *httptest.Server) gjson.Result

Types

type JanitorConsentTestHelper

type JanitorConsentTestHelper struct {
	Lifespan time.Duration
	// contains filtered or unexported fields
}

func NewConsentJanitorTestHelper

func NewConsentJanitorTestHelper(uniqueName string) *JanitorConsentTestHelper

func (*JanitorConsentTestHelper) AccessTokenNotAfterSetup

func (j *JanitorConsentTestHelper) AccessTokenNotAfterSetup(ctx context.Context, cl client.Manager, store x.FositeStorer) func(t *testing.T)

func (*JanitorConsentTestHelper) AccessTokenNotAfterValidate

func (j *JanitorConsentTestHelper) AccessTokenNotAfterValidate(ctx context.Context, notAfter time.Time, store x.FositeStorer) func(t *testing.T)

func (*JanitorConsentTestHelper) ConsentRejectionSetup

func (j *JanitorConsentTestHelper) ConsentRejectionSetup(ctx context.Context, cm consent.Manager, cl client.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) ConsentRejectionValidate

func (j *JanitorConsentTestHelper) ConsentRejectionValidate(ctx context.Context, cm consent.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) ConsentTimeoutSetup

func (j *JanitorConsentTestHelper) ConsentTimeoutSetup(ctx context.Context, cm consent.Manager, cl client.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) ConsentTimeoutValidate

func (j *JanitorConsentTestHelper) ConsentTimeoutValidate(ctx context.Context, cm consent.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) GetAccessTokenLifespan

func (j *JanitorConsentTestHelper) GetAccessTokenLifespan() time.Duration

func (*JanitorConsentTestHelper) GetConfig

func (j *JanitorConsentTestHelper) GetConfig() *config.Provider

func (*JanitorConsentTestHelper) GetConsentRequestLifespan

func (j *JanitorConsentTestHelper) GetConsentRequestLifespan() time.Duration

func (*JanitorConsentTestHelper) GetDSN

func (j *JanitorConsentTestHelper) GetDSN() string

func (*JanitorConsentTestHelper) GetNotAfterTestCycles

func (j *JanitorConsentTestHelper) GetNotAfterTestCycles() map[string]time.Duration

func (*JanitorConsentTestHelper) GetRefreshTokenLifespan

func (j *JanitorConsentTestHelper) GetRefreshTokenLifespan() time.Duration

func (*JanitorConsentTestHelper) GetRegistry

func (j *JanitorConsentTestHelper) GetRegistry(ctx context.Context, dbname string) (driver.Registry, error)

func (*JanitorConsentTestHelper) GrantNotAfterSetup

func (j *JanitorConsentTestHelper) GrantNotAfterSetup(ctx context.Context, cl client.Manager, gr trust.GrantManager) func(t *testing.T)

func (*JanitorConsentTestHelper) GrantNotAfterValidate

func (j *JanitorConsentTestHelper) GrantNotAfterValidate(ctx context.Context, notAfter time.Time, gr trust.GrantManager) func(t *testing.T)

func (*JanitorConsentTestHelper) LimitSetup

func (j *JanitorConsentTestHelper) LimitSetup(ctx context.Context, cm consent.Manager, cl client.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LimitValidate

func (j *JanitorConsentTestHelper) LimitValidate(ctx context.Context, cm consent.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LoginConsentNotAfterSetup

func (j *JanitorConsentTestHelper) LoginConsentNotAfterSetup(ctx context.Context, cm consent.Manager, cl client.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LoginConsentNotAfterValidate

func (j *JanitorConsentTestHelper) LoginConsentNotAfterValidate(ctx context.Context, notAfter time.Time, consentRequestLifespan time.Time, cm consent.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LoginRejectionSetup

func (j *JanitorConsentTestHelper) LoginRejectionSetup(ctx context.Context, cm consent.Manager, cl client.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LoginRejectionValidate

func (j *JanitorConsentTestHelper) LoginRejectionValidate(ctx context.Context, cm consent.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LoginTimeoutSetup

func (j *JanitorConsentTestHelper) LoginTimeoutSetup(ctx context.Context, cm consent.Manager, cl client.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) LoginTimeoutValidate

func (j *JanitorConsentTestHelper) LoginTimeoutValidate(ctx context.Context, cm consent.Manager) func(t *testing.T)

func (*JanitorConsentTestHelper) RefreshTokenNotAfterSetup

func (j *JanitorConsentTestHelper) RefreshTokenNotAfterSetup(ctx context.Context, cl client.Manager, store x.FositeStorer) func(t *testing.T)

func (*JanitorConsentTestHelper) RefreshTokenNotAfterValidate

func (j *JanitorConsentTestHelper) RefreshTokenNotAfterValidate(ctx context.Context, notAfter time.Time, store x.FositeStorer) func(t *testing.T)

Jump to

Keyboard shortcuts

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