github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/pkg/auth/oidc/encoding/encoding.go (about) 1 // Package encoding defines Claims for interoperable external services to 2 // use in JWTs. An external service that imports this package receives a 3 // Claims with a stable gob encoding. 4 package encoding 5 6 import "encoding/gob" 7 8 type Claims map[string]interface{} 9 10 // OIDCClaimsSerdeNickname is the typename used to serialize Claims using 11 // gob encoding in JWT. It is the default value that gob would give had 12 // Claims been part of auth. It is not (any longer), explicitly to allow 13 // external services to serialize matching claims. 14 const OIDCClaimsSerdeNickname = "github.com/treeverse/lakefs/pkg/auth/oidc.Claims" 15 16 // init registers OIDCSerdeNickname as the typename used to serialize Claims 17 // using gob encoding in JWT. It should be called in an init() func of a 18 // package in any external service that produces matching claims. 19 // 20 // nolint:gochecknoinits 21 func init() { 22 // Register at startup, gob.Register says: "Expecting to be used 23 // only during initialization...". 24 gob.RegisterName(OIDCClaimsSerdeNickname, Claims{}) 25 }