oauth2gorm

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2021 License: MIT Imports: 7 Imported by: 0

README

GORM (v1) Storage for OAuth 2.0 v3

GitHub

Based on go-oauth2-mysql.

Documentation

Index

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
}

func NewClientStore

func NewClientStore(db *gorm.DB, options ...ClientStoreOption) (*ClientStore, error)

NewClientStore creates client store instance

func (*ClientStore) Create

func (s *ClientStore) Create(info oauth2.ClientInfo) error

Create creates and stores the new client information

func (*ClientStore) GetByID

func (s *ClientStore) GetByID(id string) (oauth2.ClientInfo, error)

GetByID retrieves and returns client information by id

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 WithClientStoreTableName

func WithClientStoreTableName(tableName string) ClientStoreOption

WithClientStoreTableName returns option that sets client store table name

type TokenStore

type TokenStore struct {
	// contains filtered or unexported fields
}

func NewTokenStore

func NewTokenStore(db *gorm.DB, options ...TokenStoreOption) (*TokenStore, error)

NewTokenStore creates token store instance

func (*TokenStore) Close

func (s *TokenStore) Close() error

Close close the store

func (*TokenStore) Create

func (s *TokenStore) Create(info oauth2.TokenInfo) error

Create create and store the new token information

func (*TokenStore) GetByAccess

func (s *TokenStore) GetByAccess(access string) (oauth2.TokenInfo, error)

GetByAccess use the access token for token information data

func (*TokenStore) GetByCode

func (s *TokenStore) GetByCode(code string) (oauth2.TokenInfo, error)

GetByCode use the authorization code for token information data

func (*TokenStore) GetByRefresh

func (s *TokenStore) GetByRefresh(refresh string) (oauth2.TokenInfo, error)

GetByRefresh use the refresh token for token information data

func (*TokenStore) RemoveByAccess

func (s *TokenStore) RemoveByAccess(access string) error

RemoveByAccess use the access token to delete the token information

func (*TokenStore) RemoveByCode

func (s *TokenStore) RemoveByCode(code string) error

RemoveByCode delete the authorization code

func (*TokenStore) RemoveByRefresh

func (s *TokenStore) RemoveByRefresh(refresh string) error

RemoveByRefresh use the refresh token to delete the token information

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 WithTokenStoreTableName

func WithTokenStoreTableName(tableName string) TokenStoreOption

WithTokenStoreTableName returns option that sets token store table name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL