testhelpers

package
v1.11.10 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 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 added in v1.10.0

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 added in v1.11.10

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

func RequireEqualTime added in v1.11.10

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

func UpdateClientTokenLifespans added in v1.11.10

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 added in v1.10.0

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

func NewConsentJanitorTestHelper added in v1.10.0

func NewConsentJanitorTestHelper(uniqueName string) *JanitorConsentTestHelper

func (*JanitorConsentTestHelper) AccessTokenNotAfterSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) AccessTokenNotAfterValidate added in v1.10.0

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

func (*JanitorConsentTestHelper) ConsentRejectionSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) ConsentRejectionValidate added in v1.10.0

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

func (*JanitorConsentTestHelper) ConsentTimeoutSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) ConsentTimeoutValidate added in v1.10.0

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

func (*JanitorConsentTestHelper) GetAccessTokenLifespan added in v1.10.0

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

func (*JanitorConsentTestHelper) GetConfig added in v1.10.0

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

func (*JanitorConsentTestHelper) GetConsentRequestLifespan added in v1.10.0

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

func (*JanitorConsentTestHelper) GetDSN added in v1.10.0

func (j *JanitorConsentTestHelper) GetDSN() string

func (*JanitorConsentTestHelper) GetNotAfterTestCycles added in v1.10.0

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

func (*JanitorConsentTestHelper) GetRefreshTokenLifespan added in v1.10.0

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

func (*JanitorConsentTestHelper) GetRegistry added in v1.10.0

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

func (*JanitorConsentTestHelper) GrantNotAfterSetup added in v1.11.0

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

func (*JanitorConsentTestHelper) GrantNotAfterValidate added in v1.11.0

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

func (*JanitorConsentTestHelper) LimitSetup added in v1.10.5

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

func (*JanitorConsentTestHelper) LimitValidate added in v1.10.5

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

func (*JanitorConsentTestHelper) LoginConsentNotAfterSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) LoginConsentNotAfterValidate added in v1.10.0

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

func (*JanitorConsentTestHelper) LoginRejectionSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) LoginRejectionValidate added in v1.10.0

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

func (*JanitorConsentTestHelper) LoginTimeoutSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) LoginTimeoutValidate added in v1.10.0

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

func (*JanitorConsentTestHelper) RefreshTokenNotAfterSetup added in v1.10.0

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

func (*JanitorConsentTestHelper) RefreshTokenNotAfterValidate added in v1.10.0

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