Documentation
¶
Index ¶
- Constants
- func NewRedisStore(cfg *RedisConfig) (store oauth2.TokenStore, err error)
- type RedisConfig
- type RedisStore
- func (rs *RedisStore) Create(info oauth2.TokenInfo) (err error)
- func (rs *RedisStore) GetByAccess(access string) (ti oauth2.TokenInfo, err error)
- func (rs *RedisStore) GetByRefresh(refresh string) (ti oauth2.TokenInfo, err error)
- func (rs *RedisStore) RemoveByAccess(access string) (err error)
- func (rs *RedisStore) RemoveByRefresh(refresh string) (err error)
Constants ¶
View Source
const DefaultIncrKey = "oauth2_incr"
DefaultIncrKey store incr id
Variables ¶
This section is empty.
Functions ¶
func NewRedisStore ¶
func NewRedisStore(cfg *RedisConfig) (store oauth2.TokenStore, err error)
NewRedisStore Create a token store instance based on redis
Types ¶
type RedisConfig ¶
type RedisConfig struct {
// The network type, either tcp or unix.
// Default is tcp.
Network string
// host:port address.
Addr string
// An optional password. Must match the password specified in the
// requirepass server configuration option.
Password string
// A database to be selected after connecting to server.
DB int
// The maximum number of retries before giving up.
// Default is to not retry failed commands.
MaxRetries int
// Sets the deadline for establishing new connections. If reached,
// dial will fail with a timeout.
// Default is 5 seconds.
DialTimeout time.Duration
// Sets the deadline for socket reads. If reached, commands will
// fail with a timeout instead of blocking.
ReadTimeout time.Duration
// Sets the deadline for socket writes. If reached, commands will
// fail with a timeout instead of blocking.
WriteTimeout time.Duration
// The maximum number of socket connections.
// Default is 10 connections.
PoolSize int
// Specifies amount of time client waits for connection if all
// connections are busy before returning an error.
// Default is 1 second.
PoolTimeout time.Duration
}
RedisConfig Redis Configuration
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore Redis Store
func (*RedisStore) Create ¶
func (rs *RedisStore) Create(info oauth2.TokenInfo) (err error)
Create Create and store the new token information
func (*RedisStore) GetByAccess ¶
func (rs *RedisStore) GetByAccess(access string) (ti oauth2.TokenInfo, err error)
GetByAccess Use the access token for token information data
func (*RedisStore) GetByRefresh ¶
func (rs *RedisStore) GetByRefresh(refresh string) (ti oauth2.TokenInfo, err error)
GetByRefresh Use the refresh token for token information data
func (*RedisStore) RemoveByAccess ¶
func (rs *RedisStore) RemoveByAccess(access string) (err error)
RemoveByAccess Use the access token to delete the token information(Along with the refresh token)
func (*RedisStore) RemoveByRefresh ¶
func (rs *RedisStore) RemoveByRefresh(refresh string) (err error)
RemoveByRefresh Use the refresh token to delete the token information
Click to show internal directories.
Click to hide internal directories.