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