Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnknownTokenService is returned when a token name is // requested that isn't registered. ErrUnknownTokenService = errors.New("no token service with that name exists") // unavailable to the token service. For token systems that // use symmetric cryptography this is fatal, for token systems // that use asymmetric cryptography, this may be acceptable if // all you want to do is verify a token with a public key. ErrKeyUnavailable = errors.New("a required key is not available") // ErrKeyGenerationDisabled is returned when no keys were // available to load, and the option to generate keys has been // set false. ErrKeyGenerationDisabled = errors.New("key generation is disabled") // ErrInternalError captures all unidentified error cases // within various token services. ErrInternalError = errors.New("an unrecoverable internal error has occurred") // ErrTokenInvalid is returned for generic cases where the // token is invalid for some reason. ErrTokenInvalid = errors.New("the provided token is invalid") )
Functions ¶
func SetLifetime ¶ added in v0.3.4
SetLifetime sets up the lifetime used by tokens that are issued later on.
func SetParentLogger ¶ added in v0.3.4
func SetParentLogger(l hclog.Logger)
SetParentLogger sets the parent logger for this instance.
Types ¶
type Claims ¶
type Claims struct { EntityID string Capabilities []pb.Capability }
Claims is a type that contains the claims that all tokens shall have. Implementations may embed additional messages, but these cliams must exist here.
func (*Claims) HasCapability ¶
func (c *Claims) HasCapability(cap pb.Capability) bool
HasCapability is a convenience function to determine if the provided token contains the requested capability. The capability GLOBAL_ROOT will cause the function to return true immediately as GLOBAL_ROOT counts for all capabilities.
Click to show internal directories.
Click to hide internal directories.