Documentation
¶
Index ¶
- Constants
- Variables
- func Ctx() context.Context
- func HandleByPanic(err error)
- func Report(t *testing.T, condition bool, message string, args ...interface{})
- type TestConfig
- func (tc *TestConfig) CachedServer(claimMappings map[string]string) *decoder.Server
- func (tc *TestConfig) NewExpiredToken(claims map[string]interface{}) []byte
- func (tc *TestConfig) NewInvalidToken(claims map[string]interface{}) []byte
- func (tc *TestConfig) NewValidToken(claims map[string]interface{}) []byte
- func (tc *TestConfig) UncachedServer(claimMappings map[string]string) *decoder.Server
Constants ¶
View Source
const ( // AuthHeaderKey for the test AuthHeaderKey = "Authorization" // TokenValidatedHeaderKey for the test TokenValidatedHeaderKey = "jwt-token-validated" // AuthHeaderRequired for the test AuthHeaderRequired = false )
Variables ¶
Functions ¶
func HandleByPanic ¶
func HandleByPanic(err error)
HandleByPanic handles a non nil error by panicing
Types ¶
type TestConfig ¶
type TestConfig struct { // JwksURL is where the JWKS is hosted JwksURL string // contains filtered or unexported fields }
TestConfig holds most config used for tests also starts a JWKS server
func (*TestConfig) CachedServer ¶
func (tc *TestConfig) CachedServer(claimMappings map[string]string) *decoder.Server
CachedServer creates a cached server
func (*TestConfig) NewExpiredToken ¶
func (tc *TestConfig) NewExpiredToken(claims map[string]interface{}) []byte
NewExpiredToken generates a signed but expired token with the given claims
func (*TestConfig) NewInvalidToken ¶
func (tc *TestConfig) NewInvalidToken(claims map[string]interface{}) []byte
NewInvalidToken generates a token signed with a key that does not exist in the JWKS
func (*TestConfig) NewValidToken ¶
func (tc *TestConfig) NewValidToken(claims map[string]interface{}) []byte
NewValidToken generates a signed valid token with the given claims
func (*TestConfig) UncachedServer ¶
func (tc *TestConfig) UncachedServer(claimMappings map[string]string) *decoder.Server
UncachedServer creates an uncached server
Click to show internal directories.
Click to hide internal directories.