Documentation
¶
Overview ¶
Package authtest provides test fixtures (stub authenticators, signed JWTs, etc.) that downstream services use to exercise auth-protected HTTP / gRPC handlers without spinning up a real identity provider.
Index ¶
- func NewGrpcAuthenticator(opts ...grpcAuthenticatorOption) *grpcAuthenticator
- func NewHTTPAuthenticator() *httpAuthenticator
- func NewMockJWT(accountID uuid.UUID, username string) *mockJWT
- func NewMockProvider(uid, email string) *mockProvider
- func NewStrictGrpcAuthenticator(subject string) *strictGrpcAuthenticator
- func NewTokenClaims(subject string) *tokenClaims
- func WithGrpcAuthenticatorSubject(subject string) grpcAuthenticatorOption
- type ContextInjector
- type ContextInjector_Expecter
- type ContextInjector_Inject_Call
- func (_c *ContextInjector_Inject_Call) Return(context1 context.Context, err error) *ContextInjector_Inject_Call
- func (_c *ContextInjector_Inject_Call) Run(run func(ctx context.Context, token auth.Token)) *ContextInjector_Inject_Call
- func (_c *ContextInjector_Inject_Call) RunAndReturn(run func(ctx context.Context, token auth.Token) (context.Context, error)) *ContextInjector_Inject_Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGrpcAuthenticator ¶
func NewGrpcAuthenticator(opts ...grpcAuthenticatorOption) *grpcAuthenticator
func NewHTTPAuthenticator ¶
func NewHTTPAuthenticator() *httpAuthenticator
func NewMockJWT ¶
NewMockJWT creates a new mock JWT issuer/validator for testing
func NewMockProvider ¶
func NewMockProvider(uid, email string) *mockProvider
NewMockProvider creates a new mock authentication provider for testing
func NewStrictGrpcAuthenticator ¶
func NewStrictGrpcAuthenticator(subject string) *strictGrpcAuthenticator
NewStrictGrpcAuthenticator creates an authenticator that actually validates auth headers
func NewTokenClaims ¶
func NewTokenClaims(subject string) *tokenClaims
func WithGrpcAuthenticatorSubject ¶
func WithGrpcAuthenticatorSubject(subject string) grpcAuthenticatorOption
Types ¶
type ContextInjector ¶
ContextInjector is an autogenerated mock type for the ContextInjector type
func NewContextInjector ¶
func NewContextInjector(t interface {
mock.TestingT
Cleanup(func())
}) *ContextInjector
NewContextInjector creates a new instance of ContextInjector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*ContextInjector) EXPECT ¶
func (_m *ContextInjector) EXPECT() *ContextInjector_Expecter
type ContextInjector_Expecter ¶
type ContextInjector_Expecter struct {
// contains filtered or unexported fields
}
func (*ContextInjector_Expecter) Inject ¶
func (_e *ContextInjector_Expecter) Inject(ctx interface{}, token interface{}) *ContextInjector_Inject_Call
Inject is a helper method to define mock.On call
- ctx context.Context
- token auth.Token
type ContextInjector_Inject_Call ¶
ContextInjector_Inject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Inject'
func (*ContextInjector_Inject_Call) Return ¶
func (_c *ContextInjector_Inject_Call) Return(context1 context.Context, err error) *ContextInjector_Inject_Call
func (*ContextInjector_Inject_Call) Run ¶
func (_c *ContextInjector_Inject_Call) Run(run func(ctx context.Context, token auth.Token)) *ContextInjector_Inject_Call
func (*ContextInjector_Inject_Call) RunAndReturn ¶
func (_c *ContextInjector_Inject_Call) RunAndReturn(run func(ctx context.Context, token auth.Token) (context.Context, error)) *ContextInjector_Inject_Call