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 ¶
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.
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 ¶
GetRequestMetadata attaches the authorization header to each RPC.
func (Token) RequireTransportSecurity ¶
RequireTransportSecurity prevents tokens being sent over plaintext transport.