Documentation ¶
Index ¶
- func InsertAccessToken(ts *TokenStore, token string, basicID string, expiresAt string) (err error)
- func InsertAuthorizationCode(ts *TokenStore, code string, data []byte, expiresAt string) (err error)
- func InsertRefreshToken(ts *TokenStore, token string, basicID string, expiresAt string) (err error)
- type ClientConfig
- type ClientStore
- type TokenConfig
- type TokenStore
- func (ts *TokenStore) Create(info oauth2.TokenInfo) (err error)
- func (ts *TokenStore) GetByAccess(access string) (ti oauth2.TokenInfo, err error)
- func (ts *TokenStore) GetByCode(code string) (ti oauth2.TokenInfo, err error)
- func (ts *TokenStore) GetByRefresh(refresh string) (ti oauth2.TokenInfo, err error)
- func (ts *TokenStore) RemoveByAccess(access string) (err error)
- func (ts *TokenStore) RemoveByCode(code string) (err error)
- func (ts *TokenStore) RemoveByRefresh(refresh string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertAccessToken ¶
func InsertAccessToken(ts *TokenStore, token string, basicID string, expiresAt string) (err error)
InsertAccessToken inserts an access code into the basic table
func InsertAuthorizationCode ¶
func InsertAuthorizationCode(ts *TokenStore, code string, data []byte, expiresAt string) (err error)
InsertAuthorizationCode inserts an authorization code into the basic table
func InsertRefreshToken ¶
func InsertRefreshToken(ts *TokenStore, token string, basicID string, expiresAt string) (err error)
InsertRefreshToken inserts an access code into the basic table
Types ¶
type ClientConfig ¶
type ClientConfig struct { // store clients data collection name(The default is oauth2_clients) ClientsCName string }
ClientConfig client configuration parameters
func NewDefaultClientConfig ¶
func NewDefaultClientConfig() *ClientConfig
NewDefaultClientConfig create a default client configuration
type ClientStore ¶
type ClientStore struct {
// contains filtered or unexported fields
}
ClientStore DynamoDB storage for OAuth 2.0
func NewClientStore ¶
func NewClientStore(client *dynamodb.DynamoDB, ccfg *ClientConfig) (store *ClientStore)
NewClientStore create a client store instance based on dynamodb
func (*ClientStore) GetByID ¶
func (cs *ClientStore) GetByID(id string) (info oauth2.ClientInfo, err error)
GetByID according to the ID for the client information
func (*ClientStore) RemoveByID ¶
func (cs *ClientStore) RemoveByID(id string) (err error)
RemoveByID use the client id to delete the client information
func (*ClientStore) Set ¶
func (cs *ClientStore) Set(info oauth2.ClientInfo) (err error)
Set set client information
type TokenConfig ¶
type TokenConfig struct { // store token based data collection name(The default is oauth2_basic) BasicCName string // store access token data collection name(The default is oauth2_access) AccessCName string // store refresh token data collection name(The default is oauth2_refresh) RefreshCName string }
TokenConfig token configuration parameters
func NewDefaultTokenConfig ¶
func NewDefaultTokenConfig() (config *TokenConfig)
NewDefaultTokenConfig returns a default token config
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore stores the dynamodb client and token config
func NewTokenStore ¶
func NewTokenStore(client *dynamodb.DynamoDB, tokenConfig *TokenConfig) (store *TokenStore)
NewTokenStore returns a new token store
func (*TokenStore) Create ¶
func (ts *TokenStore) Create(info oauth2.TokenInfo) (err error)
Create creates
func (*TokenStore) GetByAccess ¶
func (ts *TokenStore) GetByAccess(access string) (ti oauth2.TokenInfo, err error)
GetByAccess use the access token for token information data
func (*TokenStore) GetByCode ¶
func (ts *TokenStore) GetByCode(code string) (ti oauth2.TokenInfo, err error)
GetByCode use the authorization code for token information data
func (*TokenStore) GetByRefresh ¶
func (ts *TokenStore) GetByRefresh(refresh string) (ti oauth2.TokenInfo, err error)
GetByRefresh use the refresh token for token information data
func (*TokenStore) RemoveByAccess ¶
func (ts *TokenStore) RemoveByAccess(access string) (err error)
RemoveByAccess use the access token to delete the token information
func (*TokenStore) RemoveByCode ¶
func (ts *TokenStore) RemoveByCode(code string) (err error)
RemoveByCode use the authorization code to delete the token information
func (*TokenStore) RemoveByRefresh ¶
func (ts *TokenStore) RemoveByRefresh(refresh string) (err error)
RemoveByRefresh use the refresh token to delete the token information