Documentation ¶
Index ¶
- func NewFileTokenStore(filename string) (oauth2.TokenStore, error)
- func NewMemoryTokenStore() (oauth2.TokenStore, error)
- type ClientStore
- type TokenStore
- func (ts *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error
- func (ts *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
- func (ts *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)
- func (ts *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)
- func (ts *TokenStore) GetTokenByUserId(ctx context.Context, userId string) string
- func (ts *TokenStore) RemoveByAccess(ctx context.Context, access string) error
- func (ts *TokenStore) RemoveByCode(ctx context.Context, code string) error
- func (ts *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFileTokenStore ¶
NewFileTokenStore create a token store instance based on file
func NewMemoryTokenStore ¶
func NewMemoryTokenStore() (oauth2.TokenStore, error)
NewMemoryTokenStore create a token store instance based on memory
Types ¶
type ClientStore ¶
ClientStore client information store
func NewClientMySqlStore ¶
func NewClientMySqlStore(dbs *sql.DB, table string) *ClientStore
NewClientMySqlStore TODO 改动1,mysql存储 改在初始化存储时
func (*ClientStore) GetByID ¶
func (cs *ClientStore) GetByID(ctx context.Context, id string) (oauth2.ClientInfo, error)
TODO,改动2,新添加了两个数据,一个是传入的mysql连接,一个是表名 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 TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore token storage based on buntdb(https://github.com/tidwall/buntdb)
func (*TokenStore) Create ¶
func (ts *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error
Create create and store the new token information
func (*TokenStore) GetByAccess ¶
func (ts *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
GetByAccess use the access token for token information data
func (*TokenStore) GetByCode ¶
func (ts *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)
GetByCode use the authorization code for token information data
func (*TokenStore) GetByRefresh ¶
func (ts *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)
GetByRefresh use the refresh token for token information data
func (*TokenStore) GetTokenByUserId ¶
func (ts *TokenStore) GetTokenByUserId(ctx context.Context, userId string) string
func (*TokenStore) RemoveByAccess ¶
func (ts *TokenStore) RemoveByAccess(ctx context.Context, access string) error
RemoveByAccess use the access token to delete the token information
func (*TokenStore) RemoveByCode ¶
func (ts *TokenStore) RemoveByCode(ctx context.Context, code string) error
RemoveByCode use the authorization code to delete the token information
func (*TokenStore) RemoveByRefresh ¶
func (ts *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
RemoveByRefresh use the refresh token to delete the token information