Documentation ¶
Index ¶
- type ClientStore
- type ClientStoreItem
- type ClientStoreOption
- type Logger
- type TokenStore
- func (s *TokenStore) Close() error
- 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
- type TokenStoreItem
- type TokenStoreOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientStore ¶
type ClientStore struct {
// contains filtered or unexported fields
}
ClientStore Mariadb client store
func NewClientStore ¶
func NewClientStore(db *sqlx.DB, options ...ClientStoreOption) (*ClientStore, error)
NewClientStore creates Mariadb store instance
func (*ClientStore) Create ¶
func (s *ClientStore) Create(info oauth2.ClientInfo) error
Create creates and stores the n ew client information
type ClientStoreItem ¶
type ClientStoreItem struct { ID string `db:"id"` Secret string `db:"secret"` Domain string `db:"domain"` Data []byte `db:"data"` }
ClientStoreItem data item
type ClientStoreOption ¶
type ClientStoreOption func(s *ClientStore)
ClientStoreOption is the configuration options type for client store
func WithClientStoreInitTableDisabled ¶
func WithClientStoreInitTableDisabled() ClientStoreOption
WithClientStoreInitTableDisabled returns option that disables table creation on client store instantiation
func WithClientStoreLogger ¶
func WithClientStoreLogger(logger Logger) ClientStoreOption
WithClientStoreLogger returns option that sets client store logger implementation
func WithClientStoreTableName ¶
func WithClientStoreTableName(tableName string) ClientStoreOption
WithClientStoreTableName returns option that sets client store table name
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Logger is the Mysql store logger interface
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore Mariadb token store
func NewTokenStore ¶
func NewTokenStore(db *sqlx.DB, options ...TokenStoreOption) (*TokenStore, error)
NewTokenStore creates Mysql store instance
func (*TokenStore) Create ¶
func (s *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error
Create creates and stores the new token information
func (*TokenStore) GetByAccess ¶
func (s *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
GetByAccess uses the access token for token information data
func (*TokenStore) GetByCode ¶
func (s *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)
GetByCode uses the authorization code for token information data
func (*TokenStore) GetByRefresh ¶
func (s *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)
GetByRefresh uses the refresh token for token information data
func (*TokenStore) RemoveByAccess ¶
func (s *TokenStore) RemoveByAccess(ctx context.Context, access string) error
RemoveByAccess uses the access token to delete the token information
func (*TokenStore) RemoveByCode ¶
func (s *TokenStore) RemoveByCode(ctx context.Context, code string) error
RemoveByCode deletes the authorization code
func (*TokenStore) RemoveByRefresh ¶
func (s *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
RemoveByRefresh uses the refresh token to delete the token information
type TokenStoreItem ¶
type TokenStoreItem struct { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` ExpiresAt time.Time `db:"expires_at"` Code string `db:"code"` Access string `db:"access"` Refresh string `db:"refresh"` Data []byte `db:"data"` }
TokenStoreItem data item
type TokenStoreOption ¶
type TokenStoreOption func(s *TokenStore)
TokenStoreOption is the configuration options type for token store
func WithTokenStoreGCDisabled ¶
func WithTokenStoreGCDisabled() TokenStoreOption
WithTokenStoreGCDisabled returns option that disables token store garbage collection
func WithTokenStoreGCInterval ¶
func WithTokenStoreGCInterval(gcInterval time.Duration) TokenStoreOption
WithTokenStoreGCInterval returns option that sets token store garbage collection interval
func WithTokenStoreInitTableDisabled ¶
func WithTokenStoreInitTableDisabled() TokenStoreOption
WithTokenStoreInitTableDisabled returns option that disables table creation on token store instantiation
func WithTokenStoreLogger ¶
func WithTokenStoreLogger(logger Logger) TokenStoreOption
WithTokenStoreLogger returns option that sets token store logger implementation
func WithTokenStoreTableName ¶
func WithTokenStoreTableName(tableName string) TokenStoreOption
WithTokenStoreTableName returns option that sets token store table name