Documentation ¶
Overview ¶
Package jwtutil simplifies generating properly formatted web tokens for our use.
Index ¶
- func LoadTestKeys(t *testing.T) jwk.Set
- func MakeAgentJWT(agent string, clock jwt.Clock) (string, error)
- func MakeServiceJWT(epType string, epName string, agent string, clock jwt.Clock) (string, error)
- func MutateHeader(data string, clock jwt.Clock) (signed []byte, err error)
- func MutationIsRegistered() bool
- func RegisterAgentKeyset(keyset jwk.Set, signingKeyName string) error
- func RegisterMutationKeyset(keyset jwk.Set, signingKeyName string) error
- func RegisterServiceKeyset(keyset jwk.Set, signingKeyName string) error
- func UnmutateHeader(tokenString []byte, clock jwt.Clock) (username string, err error)
- func UnregisterMutationKeyset()
- func ValidateAgentJWT(tokenString string, clock jwt.Clock) (string, error)
- func ValidateServiceJWT(tokenString string, clock jwt.Clock) (epType string, epName string, agent string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTestKeys ¶
LoadTestKeys is a helper method to load test keys, which obviously should not be used in production...
func MakeAgentJWT ¶
MakeAgentJWT will return a token with provided type, name, and agent name embedded in the claims.
func MakeServiceJWT ¶
MakeServiceJWT will return a token with provided type, name, and agent name embedded in the claims.
func MutateHeader ¶
MutateHeader will take a header value (as a string) and return a JWT which we can later use in UnmutateHeader to recover the original string value.
func MutationIsRegistered ¶
func MutationIsRegistered() bool
MutationIsRegistered indicates if RegisterMutationKeyset was called at least once.
func RegisterAgentKeyset ¶
RegisterAgentKeyset registers (or re-registers) a new keyset and signing key name.
func RegisterMutationKeyset ¶
RegisterMutationKeyset registers (or re-registers) a new keyset and signing key name.
func RegisterServiceKeyset ¶
RegisterServiceKeyset registers (or re-registers) a new keyset and signing key name.
func UnmutateHeader ¶
UnmutateHeader checks the mutated data and returns the unmutated original content.
func UnregisterMutationKeyset ¶
func UnregisterMutationKeyset()
UnregisterMutationKeyset removes the registration. This is mostly for testing.
func ValidateAgentJWT ¶
ValidateAgentJWT will validate and return the enbedded claims.
Types ¶
This section is empty.