Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Root scope allows ANY operation ScopeRoot = version.GitSource + "/scope/root" )
Functions ¶
Types ¶
type Config ¶
type Config struct {
TokenJar TokenJar `hcl:"token_jar" description:"Persistent storage for tokens"`
TokenBytes int `hcl:"token_bytes" description:"Number of bytes in a token"`
}
func (Config) Description ¶
Description returns the description of the service
type Token ¶
type Token struct {
Name string `json:"name,omitempty"` // Name of the token
Value string `json:"token,omitempty"` // Token value
Expire time.Time `json:"expire_time,omitempty"` // Time of expiration for the token
Time time.Time `json:"access_time"` // Time of last access
Scope []string `json:"scopes,omitempty"` // Authentication scopes
}
func NewToken ¶
Create a token of the specified number of bytes, with the specified duration and scope. If the duration is zero, the token will not expire.
func (Token) MarshalJSON ¶
type TokenCreate ¶
type TokenJar ¶
type TokenJar interface {
// Run the token jar until cancelled
Run(context.Context) error
// Return all tokens
Tokens() []Token
// Return a token from the jar by value, or an invalid token
// if the token is not found. The method should update the access
// time of the token.
GetWithValue(string) Token
// Return a token from the jar by name, or nil if the token
// is not found. The method should not update the access time
// of the token.
GetWithName(string) Token
// Put a token into the jar, assuming it does not yet exist.
Create(Token) error
// Update an existing token in the jar, assuming it already exists.
Update(Token) error
// Remove a token from the jar, based on key.
Delete(string) error
}
Click to show internal directories.
Click to hide internal directories.