store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientStore

type ClientStore struct {
	DB    *gorm.DB
	Cache cache.ICacheProvider
	// contains filtered or unexported fields
}

ClientStore 用于存储Client信息的

func NewClientStore

func NewClientStore(db *gorm.DB) *ClientStore

func (*ClientStore) GetByID

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

GetByID 通过ID获取Client信息

func (*ClientStore) ValidateSecret

func (cs *ClientStore) ValidateSecret(clientId, secret string) error

type DBTokenStore

type DBTokenStore struct {
	DB *gorm.DB
}

DBTokenStore 存储于数据库的Token

func (*DBTokenStore) Create

func (dts *DBTokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error

Create and store the new token information

func (*DBTokenStore) GetByAccess

func (dts *DBTokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)

GetByAccess use the access token for token information data

func (*DBTokenStore) GetByCode

func (dts *DBTokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)

GetByCode use the authorization code for token information data

func (*DBTokenStore) GetByRefresh

func (dts *DBTokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)

GetByRefresh use the refresh token for token information data

func (*DBTokenStore) RemoveByAccess

func (dts *DBTokenStore) RemoveByAccess(ctx context.Context, access string) error

RemoveByAccess use the access token to delete the token information

func (*DBTokenStore) RemoveByCode

func (dts *DBTokenStore) RemoveByCode(ctx context.Context, code string) error

RemoveByCode delete the authorization code

func (*DBTokenStore) RemoveByRefresh

func (dts *DBTokenStore) RemoveByRefresh(ctx context.Context, refresh string) error

RemoveByRefresh use the refresh token to delete the token information

type DbUserStore

type DbUserStore struct {
	// contains filtered or unexported fields
}

func NewDbUserStore

func NewDbUserStore(db *gorm.DB) *DbUserStore

func (*DbUserStore) GetClaims

func (ds *DbUserStore) GetClaims(account string, scope string) (interface{}, error)

func (*DbUserStore) GetUserByAccount

func (ds *DbUserStore) GetUserByAccount(account string) (*models.User, error)

func (*DbUserStore) GetUserByID

func (ds *DbUserStore) GetUserByID(id string) (*models.User, error)

func (*DbUserStore) GetUserPasswordHash

func (ds *DbUserStore) GetUserPasswordHash(account string) (string, error)

type UserStore

type UserStore interface {
	GetUserByAccount(account string) (*models.User, error)
	GetUserByID(id string) (*models.User, error)
	GetUserPasswordHash(account string) (string, error)
	GetClaims(account string, scope string) (interface{}, error)
}

Jump to

Keyboard shortcuts

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