Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultPerms = []auth.Permission{"public"} ReadPerms = []auth.Permission{"public", "read"} ReadWritePerms = []auth.Permission{"public", "read", "write"} AllPerms = []auth.Permission{"public", "read", "write", "admin"} )
View Source
var AuthKey = "Authorization"
Functions ¶
func NewTokenWithPerms ¶
func NewTokenWithPerms(signer jwt.Signer, perms []auth.Permission) ([]byte, error)
NewTokenWithPerms generates and signs a new JWT token with the given secret and given permissions.
func NewTokenWithTTL ¶ added in v0.20.4
NewTokenWithTTL generates and signs a new JWT token with the given secret and given permissions and TTL.
Types ¶
type JWTPayload ¶
type JWTPayload struct { Allow []auth.Permission Nonce []byte ExpiresAt time.Time }
JWTPayload is a utility struct for marshaling/unmarshalling permissions into for token signing/verifying.
func (*JWTPayload) MarshalBinary ¶
func (j *JWTPayload) MarshalBinary() (data []byte, err error)
Click to show internal directories.
Click to hide internal directories.