Documentation
¶
Overview ¶
Package crpcauthtesting provides test helpers for stdcrpcauthfx that use real JWT signing and validation. A local JWKS server is started so the real authentication code path runs in tests.
Index ¶
Constants ¶
View Source
const ( // TestAudience is the audience claim used in test JWTs. TestAudience = "urn:test:audience" // TestKeyID is the key ID used for signing test JWTs. TestKeyID = "test-key" )
Variables ¶
View Source
var TestClockTime = time.Date(2026, 4, 1, 0, 0, 0, 0, time.UTC)
TestClockTime is the fixed wall-clock time used for JWT validation in tests.
Functions ¶
Types ¶
type TokenSigner ¶
type TokenSigner struct {
// contains filtered or unexported fields
}
TokenSigner signs JWTs using a test RSA key pair.
func NewJWKSServer ¶
func NewJWKSServer(tb testing.TB) (serverURL string, signer *TokenSigner)
NewJWKSServer starts a local JWKS httptest.Server and returns the server URL and a TokenSigner. The server is automatically closed when the test completes. The server URL can be used as TOKEN_ISSUER and the server serves the public key at /.well-known/jwks.json.
Click to show internal directories.
Click to hide internal directories.