goa

package module
v0.0.0-...-d23e1fe Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2019 License: MIT Imports: 8 Imported by: 0

README

Goa

Goa, short for GOrm-oAuth2 is a Gorm adapter for go-oauth2, a OAuth2 server library for Golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientStore

type ClientStore struct {
	Config ClientStoreConfig
	DB     *gorm.DB
	Ticker *time.Ticker
}

func NewClientStore

func NewClientStore(db *gorm.DB, config ClientStoreConfig) (*ClientStore, error)

Create a new client store

func (*ClientStore) Close

func (cs *ClientStore) Close()

func (*ClientStore) Create

func (cs *ClientStore) Create(info oauth2.ClientInfo) error

Create and store new client info

func (*ClientStore) GetByID

func (cs *ClientStore) GetByID(id string) (oauth2.ClientInfo, error)

Get client info by ID

type ClientStoreConfig

type ClientStoreConfig struct {
	ErrLog    *log.Logger
	InfoLog   *log.Logger
	TableName string
	TTL       time.Duration
}

type ClientStoreItem

type ClientStoreItem struct {
	ID        string `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Domain    string
	Secret    string
	UserID    string
}

type TokenStore

type TokenStore struct {
	Config TokenStoreConfig
	DB     *gorm.DB
	Ticker *time.Ticker
}

func NewTokenStore

func NewTokenStore(db *gorm.DB, config TokenStoreConfig) (*TokenStore, error)

Create a new token store

func (*TokenStore) Close

func (ts *TokenStore) Close()

func (*TokenStore) Create

func (ts *TokenStore) Create(info oauth2.TokenInfo) error

Create and store new token info

func (*TokenStore) GetByAccess

func (ts *TokenStore) GetByAccess(access string) (oauth2.TokenInfo, error)

Get token info by Access

func (*TokenStore) GetByCode

func (ts *TokenStore) GetByCode(code string) (oauth2.TokenInfo, error)

Get token info by Code

func (*TokenStore) GetByRefresh

func (ts *TokenStore) GetByRefresh(refresh string) (oauth2.TokenInfo, error)

Get token info by Refresh

func (*TokenStore) RemoveByAccess

func (ts *TokenStore) RemoveByAccess(access string) error

Remove token info by Access

func (*TokenStore) RemoveByRefresh

func (ts *TokenStore) RemoveByRefresh(refresh string) error

Remove token info by Refresh

func (*TokenStore) RmoveByCode

func (ts *TokenStore) RmoveByCode(code string) error

Remove token info by Code

type TokenStoreConfig

type TokenStoreConfig struct {
	ErrLog    *log.Logger
	InfoLog   *log.Logger
	TableName string
	TTL       time.Duration
}

type TokenStoreItem

type TokenStoreItem struct {
	ID        string `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	ExpiresAt time.Time
	Code      string `gorm:"index:idx_code"`
	Access    string `gorm:"index:idx_access"`
	Refresh   string `gorm:"index:idx_refresh"`
	Data      string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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