Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
jwt.RegisteredClaims
OrganizationID string `json:"organization_id,omitempty"`
GroupIDs []string `json:"group_ids,omitempty"`
}
Claims represents the JWT claims from miren.cloud
type JWK ¶
type JWK struct {
Kty string `json:"kty"` // Key type (OKP for Ed25519)
Kid string `json:"kid"` // Key ID
Use string `json:"use"` // Key use (sig)
Alg string `json:"alg"` // Algorithm (EdDSA)
Crv string `json:"crv"` // Curve (Ed25519)
X string `json:"x"` // X coordinate (public key for Ed25519)
}
JWK represents a JSON Web Key
type JWTValidator ¶
type JWTValidator struct {
// contains filtered or unexported fields
}
JWTValidator validates JWT tokens from miren.cloud using EdDSA signatures. It fetches public keys from the JWKS endpoint at {cloudURL}/.well-known/jwks.json and caches them for efficient validation. Only Ed25519 keys are supported.
func NewJWTValidator ¶
func NewJWTValidator(cloudURL string, logger *slog.Logger) *JWTValidator
NewJWTValidator creates a new JWT validator
func (*JWTValidator) ValidateToken ¶
ValidateToken validates a JWT token and returns the claims
type TokenCache ¶
type TokenCache struct {
// contains filtered or unexported fields
}
TokenCache caches validated tokens to reduce validation overhead
func NewTokenCache ¶
func NewTokenCache(ctx context.Context) *TokenCache
NewTokenCache creates a new token cache
func (*TokenCache) Get ¶
func (tc *TokenCache) Get(token string) (*Claims, bool)
Get retrieves claims from cache if valid
func (*TokenCache) Set ¶
func (tc *TokenCache) Set(token string, claims *Claims)
Set stores claims in cache
Click to show internal directories.
Click to hide internal directories.