Versions in this module Expand all Collapse all v0 v0.10.0 May 7, 2021 Changes in this version + var DefaultTokenTTL = time.Hour * 24 * 14 + var ErrInvalidToken = errors.New("invalid access token") + var ErrTokenNotFound = errors.New("access token not found") + var Timestamp = func() time.Time + func AddContextTokenToRequest(ctx context.Context, r *http.Request) (*http.Request, bool) + func AddToContext(ctx context.Context, s string) context.Context + func FromCtx(ctx context.Context) string + func NewPrivKeyAuthToken(pk crypto.PrivKey, profileID string, ttl time.Duration) (string, error) + func OAuthTokenMiddleware(next http.Handler) http.Handler + type Claims struct + ProfileID string + type CtxKey string + type RawToken struct + Key string + Raw string + type RawTokens []RawToken + func (rts RawTokens) Len() int + func (rts RawTokens) Less(a, b int) bool + func (rts RawTokens) Swap(i, j int) + type Source interface + CreateToken func(pro *profile.Profile, ttl time.Duration) (string, error) + CreateTokenWithClaims func(claims jwt.MapClaims, ttl time.Duration) (string, error) + VerificationKey func(t *Token) (interface{}, error) + func NewPrivKeySource(privKey crypto.PrivKey) (Source, error) + type Store interface + DeleteToken func(ctx context.Context, key string) (err error) + ListTokens func(ctx context.Context, offset, limit int) (results []RawToken, err error) + PutToken func(ctx context.Context, key, rawToken string) error + RawToken func(ctx context.Context, key string) (rawToken string, err error) + func NewStore(filepath string, fs qfs.Filesystem) (Store, error) + type Token = jwt.Token + func Parse(tokenString string, tokens Source) (*Token, error) + func ParseAuthToken(tokenString string, keystore key.Store) (*Token, error)