securityfixture

package
v1.0.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package securityfixture supplies local certificates and host middleware for security contract tests. It is test infrastructure, not Wire security policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(ctx context.Context) error

Authenticate validates the fixture's host-supplied token before Wire handlers run.

func Stream

func Stream(server any, stream grpc.ServerStream, _ *grpc.StreamServerInfo, next grpc.StreamHandler) error

Stream authenticates every stream at establishment in the test host.

func Unary

func Unary(ctx context.Context, request any, _ *grpc.UnaryServerInfo, next grpc.UnaryHandler) (any, error)

Unary authenticates every unary request in the test host.

Types

type Certificates

type Certificates struct {
	Server, Client, UntrustedClient tls.Certificate
	Roots, OtherRoots               *x509.CertPool
}

Certificates supplies trusted and unrelated identities for local TLS tests.

func NewCertificates

func NewCertificates(t testing.TB) Certificates

NewCertificates generates private test roots and matching wire.test identities.

func (Certificates) ClientConfig

func (c Certificates) ClientConfig(mutual bool) *tls.Config

ClientConfig verifies the server root and wire.test identity without exceptions.

func (Certificates) ServerConfig

func (c Certificates) ServerConfig(mutual bool) *tls.Config

ServerConfig requires trusted client certificates when mutual is true.

type Token

type Token string

Token supplies a complete authorization header on every RPC over TLS.

func (Token) GetRequestMetadata

func (t Token) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

GetRequestMetadata attaches the authorization header to each RPC.

func (Token) RequireTransportSecurity

func (Token) RequireTransportSecurity() bool

RequireTransportSecurity prevents tokens being sent over plaintext transport.

Jump to

Keyboard shortcuts

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