auth

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	Value     string     `json:"value,omitempty"`
}

Token represents an access token

func NewToken

func NewToken(id, name string) *Token

NewToken Creates a new Token instance initialized ID and Name and CreatedAt fields

type TokenStore

type TokenStore interface {
	Store(userID string, token *Token) error
	Lookup(userID string, tokenID string) (*Token, error)
	Exists(userID string, tokenID string) (bool, error)
	Revoke(userID string, tokenID string) error
	List(userID string) ([]*Token, error)
	GC() error
}

TokenStore is general interface for storing access tokens

func NewInMemoryTokenStore

func NewInMemoryTokenStore() TokenStore

NewInMemoryTokenStore is a basic in-memory TokenStore implementation (thread-safe)

func NewVaultTokenStore

func NewVaultTokenStore(role string) TokenStore

NewVaultTokenStore creates a new Vault backed token store

func NewVaultTokenStoreFromClient added in v0.4.0

func NewVaultTokenStoreFromClient(client *vault.Client) TokenStore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL