示例
Verify a JWT with golang-jwt v5 and tell an expired token apart from a forged one
sha256:b81445cb9097d69ddb4ec5db96e99cdac25b5cbebc29977426ca6bbd778260c9
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Verify a JWT with golang-jwt v5 and tell an expired token apart from a forged one MIGRATION
- 包
- github.com/golang-jwt/jwt/v5 5.3.0
- 环境
- go 1.26
- 创建时间
- 2026-08-14T06:27:58Z
契约
- sign and verify a token with claims embedded in RegisteredClaims
- assert an expired token matches both ErrTokenExpired and ErrTokenInvalidClaims
- assert a wrong key is a signature error and not an expiry
- assert alg=none is refused without opting in
- assert issuer checking is a parser option
文件
- csx.json
- go.mod
- go.sum
- src/tokens.go
- test/main.go
原始种子者
验证回执
- go 1.26 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-14 · ed25519:a2ec939a4c60e243
- · CONTAINER_RUN · compile:SKIPPED · contract:FAIL · load:SKIPPED · resolve:PASS · golang@1 · 2026-08-14 · ed25519:7da3f610facce8bf