Documentation ¶
Index ¶
- func NewStoreWithDB(config *TokenConfig, db *gorm.DB, gcInterval int) (store oauth2.TokenStore, err error)
- func NewTokenStore(config *TokenConfig, gcInterval int) (store oauth2.TokenStore, err error)
- type ClientConfig
- type ClientItem
- type ClientStore
- type Store
- func (s *Store) Close()
- func (s *Store) Create(info oauth2.TokenInfo) error
- func (s *Store) GetByAccess(access string) (oauth2.TokenInfo, error)
- func (s *Store) GetByCode(code string) (oauth2.TokenInfo, error)
- func (s *Store) GetByRefresh(refresh string) (oauth2.TokenInfo, error)
- func (s *Store) RemoveByAccess(access string) error
- func (s *Store) RemoveByCode(code string) error
- func (s *Store) RemoveByRefresh(refresh string) error
- func (s *Store) SetStdout(stdout io.Writer) *Store
- type StoreItem
- type TokenConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStoreWithDB ¶
func NewStoreWithDB(config *TokenConfig, db *gorm.DB, gcInterval int) (store oauth2.TokenStore, err error)
NewStoreWithDB create store with config
func NewTokenStore ¶
func NewTokenStore(config *TokenConfig, gcInterval int) (store oauth2.TokenStore, err error)
NewTokenStore create mysql store instance,
Types ¶
type ClientConfig ¶
ClientConfig xorm configuration
func NewClientConfig ¶
func NewClientConfig(dsn string, dbType string, tableName string) *ClientConfig
NewClientConfig create mysql configuration instance
type ClientItem ¶
type ClientItem struct { //ID int64 `gorm:"AUTO_INCREMENT"` ID string `gorm:"type:varchar(512)"` Secret string `gorm:"type:varchar(512)"` Domain string `gorm:"type:varchar(512)"` UserID string `gorm:"type:varchar(512)"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time `sql:"index"` }
ClientItem data item
type ClientStore ¶
type ClientStore struct {
// contains filtered or unexported fields
}
ClientStore client information store
func NewClientStore ¶
func NewClientStore(config *ClientConfig) (client *ClientStore, err error)
NewClientStore create a token store instance based on memory
func NewClientWithDB ¶
func NewClientWithDB(config *ClientConfig, db *gorm.DB) (client *ClientStore, err error)
NewClientWithDB create client store
func (*ClientStore) GetByID ¶
func (cs *ClientStore) GetByID(id string) (cli oauth2.ClientInfo, err error)
GetByID according to the ID for the client information
func (*ClientStore) Set ¶
func (cs *ClientStore) Set(id string, cli oauth2.ClientInfo) (err error)
Set set client information
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store mysql token store
func (*Store) GetByAccess ¶
GetByAccess use the access token for token information data
func (*Store) GetByRefresh ¶
GetByRefresh use the refresh token for token information data
func (*Store) RemoveByAccess ¶
RemoveByAccess use the access token to delete the token information
func (*Store) RemoveByCode ¶
RemoveByCode delete the authorization code
func (*Store) RemoveByRefresh ¶
RemoveByRefresh use the refresh token to delete the token information
type StoreItem ¶
type StoreItem struct { gorm.Model //ID int64 `gorm:"AUTO_INCREMENT"` ExpiredAt int64 Code string `gorm:"type:varchar(512)"` Access string `gorm:"type:varchar(512)"` Refresh string `gorm:"type:varchar(512)"` Data string `gorm:"type:text"` }
StoreItem data item saved into db
type TokenConfig ¶
TokenConfig xorm configuration
func NewTokenConfig ¶
func NewTokenConfig(dsn string, dbType string, tableName string) *TokenConfig
NewTokenConfig create mysql configuration instance