Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyNotFound should be returned by a KeyStore when // a key cannot be located for the provided key ID ErrKeyNotFound = errors.New("key not found") // EmptyKeyStore is a KeyStore implementation which contains no keys EmptyKeyStore = KeyStoreFunc(func(string) ([]byte, error) { return nil, ErrKeyNotFound }) )
Functions ¶
func IsMalformedError ¶
IsMalformedError returns true if the error returned represents a jwt malformed token error
Types ¶
type KeyStoreFunc ¶
KeyStoreFunc is a function which can be used as a KeyStore
type Token ¶
type Token struct {
jwt.StandardClaims
// KeyID is the identifier of the key used to sign the token
KeyID string `json:"kid"`
// Permissions is the set of authorized permissions for the token
Permissions []influxdb.Permission `json:"permissions"`
// UserID for the token
UserID string `json:"uid,omitempty"`
}
Token is a structure which is serialized as a json web token It contains the necessary claims required to authorize
func (*Token) EphemeralAuth ¶
func (t *Token) EphemeralAuth(orgID platform.ID) *influxdb.Authorization
EphemeralAuth creates a influxdb Auth form a jwt token
func (*Token) GetUserID ¶
GetUserID returns an invalid id as tokens are generated with permissions rather than for or by a particular user
func (*Token) Identifier ¶
Identifier returns the identifier for this Token as found in the standard claims
func (*Token) PermissionSet ¶
func (t *Token) PermissionSet() (influxdb.PermissionSet, error)
PermissionSet returns the set of permissions associated with the token.
type TokenParser ¶
type TokenParser struct {
// contains filtered or unexported fields
}
TokenParser is a type which can parse and validate tokens
func NewTokenParser ¶
func NewTokenParser(keyStore KeyStore) *TokenParser
NewTokenParser returns a configured token parser used to parse Token types from strings