Documentation
¶
Overview ¶
Package testutil provides shared test helpers used across multiple packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRSAKey ¶
func GenerateRSAKey(t *testing.T) (*rsa.PrivateKey, string)
GenerateRSAKey creates a 2048-bit RSA private key and returns both the key object and its PKCS#1 PEM-encoded string. It fails the test on error.
func GenerateRSAKeyObject ¶
func GenerateRSAKeyObject(t *testing.T) *rsa.PrivateKey
GenerateRSAKeyObject creates a 2048-bit RSA private key and returns it. It fails the test on error.
func ValidDeniedEntry ¶
func ValidDeniedEntry() *audit.AuditEntry
ValidDeniedEntry returns an AuditEntry populated with valid denied-outcome fields.
func ValidGrantedEntry ¶
func ValidGrantedEntry() *audit.AuditEntry
ValidGrantedEntry returns an AuditEntry populated with valid granted-outcome fields.
func WriteKeyFile ¶
func WriteKeyFile(t *testing.T, key *rsa.PrivateKey) string
WriteKeyFile writes an RSA private key to a temporary PEM file and returns its path. The file is removed automatically when the test finishes.
Types ¶
type OIDCServer ¶
type OIDCServer struct {
URL string
// contains filtered or unexported fields
}
OIDCServer is a minimal OIDC provider for tests. It serves discovery, JWKS, and provides token-signing helpers.
func NewOIDCServer ¶
func NewOIDCServer(t *testing.T, key *rsa.PrivateKey) *OIDCServer
NewOIDCServer creates a mock OIDC provider backed by the given RSA key.
func (*OIDCServer) SignToken ¶
func (o *OIDCServer) SignToken(t *testing.T, audience string) string
SignToken creates a signed JWT with standard claims for the given audience.
func (*OIDCServer) SignTokenWithClaims ¶
SignTokenWithClaims creates a signed JWT with arbitrary claims.