Documentation
¶
Index ¶
- Variables
- func NewFileTokenStore(path string, logger *zap.Logger) *fileTokenStore
- func NewMongoClient(user, password, host, port string, usessl bool, logger *zap.Logger) *mongo.Client
- type DefaultStore
- func (ts *DefaultStore) ContainsScopes(token *oauth2.Token, scopes ...string) bool
- func (ts *DefaultStore) GetDecoded(token *oauth2.Token) *TokenItem
- func (ts *DefaultStore) GetID(token *oauth2.Token) int32
- func (ts *DefaultStore) GetJTI(token *oauth2.Token) string
- func (ts *DefaultStore) GetName(token *oauth2.Token) string
- func (ts *DefaultStore) GetScopes(token *oauth2.Token) []string
- func (ts *DefaultStore) MatchScopes(token *oauth2.Token, scopes ...string) bool
- type TokenItem
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = &DefaultStore{}
View Source
var ErrTokenInvalid = errors.New("token is invalid")
View Source
var ErrTokenNotFound = errors.New("token not found")
Functions ¶
func NewFileTokenStore ¶
Types ¶
type DefaultStore ¶
type DefaultStore struct {
}
func (*DefaultStore) ContainsScopes ¶
func (ts *DefaultStore) ContainsScopes(token *oauth2.Token, scopes ...string) bool
func (*DefaultStore) GetDecoded ¶
func (ts *DefaultStore) GetDecoded(token *oauth2.Token) *TokenItem
func (*DefaultStore) MatchScopes ¶
func (ts *DefaultStore) MatchScopes(token *oauth2.Token, scopes ...string) bool
type TokenItem ¶
type TokenItem struct {
ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
AccessToken string `bson:"AccessToken" json:"token"`
RefreshToken string `bson:"RefreshToken" json:"refresh_token"`
TokenType string `bson:"TokenType" json:"token_type"`
CharacterName string `bson:"CharacterName" json:"character_name"`
CharacterID int32 `bson:"CharacterID" json:"character_id"`
Expiry time.Time `bson:"Expiry" json:"expiry"`
OwnerHash string `bson:"OwnerHash" json:"owner"`
JTI string `bson:"JTI" json:"jti"`
Scopes []string `bson:"Scopes" json:"scopes"`
}
type TokenStore ¶
type TokenStore interface {
Create(token *oauth2.Token) error
Read(CharacterID string, Scopes ...string) (*oauth2.Token, error)
Update(oldtoken *oauth2.Token, newtoken *oauth2.Token) error
Delete(token *oauth2.Token) error
}
func NewBadgerTokenStore ¶
func NewBadgerTokenStore(logger *zap.Logger, db *badgerhold.Store) TokenStore
func NewMongoTokenStore ¶
Click to show internal directories.
Click to hide internal directories.