Documentation ¶
Index ¶
- Constants
- type ClientStore
- type ClientStoreItem
- type Config
- type DBType
- type TokenStore
- func (s *TokenStore) Close()
- func (s *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error
- func (s *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
- func (s *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)
- func (s *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)
- func (s *TokenStore) RemoveByAccess(ctx context.Context, access string) error
- func (s *TokenStore) RemoveByCode(ctx context.Context, code string) error
- func (s *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
- func (s *TokenStore) SetStdout(stdout io.Writer) *TokenStore
- type TokenStoreItem
Constants ¶
View Source
const ( MySQL = iota PostgreSQL SQLite SQLServer )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientStore ¶
type ClientStore struct {
// contains filtered or unexported fields
}
func NewClientStore ¶
func NewClientStore(config *Config) *ClientStore
func NewClientStoreWithDB ¶
func NewClientStoreWithDB(config *Config, db *gorm.DB) *ClientStore
type ClientStoreItem ¶
type ClientStoreItem struct { gorm.Model ClientID string `gorm:"uniqueIndex;type:varchar(64);not null;comment:客户端id"` ClientSecret string `gorm:"type:varchar(128);not null;comment:客户端secret"` Domain string `gorm:"type:varchar(512);comment:允许的客户端域名,code的时候需要用到"` Data string `gorm:"type:text;comment:json数据内容"` Public bool `gorm:"comment:public"` }
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
Store mysql token store
func NewTokenStore ¶
func NewTokenStore(config *Config, gcInterval int) *TokenStore
NewStore create mysql store instance,
func NewTokenStoreWithDB ¶
func NewTokenStoreWithDB(config *Config, db *gorm.DB, gcInterval int) *TokenStore
func (*TokenStore) Create ¶
func (s *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error
Create create and store the new token information
func (*TokenStore) GetByAccess ¶
func (s *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
GetByAccess use the access token for token information data
func (*TokenStore) GetByCode ¶
func (s *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)
GetByCode use the authorization code for token information data
func (*TokenStore) GetByRefresh ¶
func (s *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)
GetByRefresh use the refresh token for token information data
func (*TokenStore) RemoveByAccess ¶
func (s *TokenStore) RemoveByAccess(ctx context.Context, access string) error
RemoveByAccess use the access token to delete the token information
func (*TokenStore) RemoveByCode ¶
func (s *TokenStore) RemoveByCode(ctx context.Context, code string) error
RemoveByCode delete the authorization code
func (*TokenStore) RemoveByRefresh ¶
func (s *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
RemoveByRefresh use the refresh token to delete the token information
func (*TokenStore) SetStdout ¶
func (s *TokenStore) SetStdout(stdout io.Writer) *TokenStore
SetStdout set error output
type TokenStoreItem ¶
type TokenStoreItem struct { gorm.Model ClientID string `gorm:"index;type:varchar(64);not null;comment:客户端id"` ExpiredAt int64 `gorm:"index;comment:过期时间"` Code string `gorm:"index;type:varchar(256);comment:code"` Access string `gorm:"index;type:varchar(256);comment:access_token"` Refresh string `gorm:"index;type:varchar(256);comment:refresh_token"` Data string `gorm:"type:text;comment:json数据内容"` }
Click to show internal directories.
Click to hide internal directories.