Documentation ¶
Index ¶
- Variables
- func UUID() string
- type BlockedUpdater
- type BuildOpts
- func AddAccessExpiry(conf ExpiryConfig) BuildOpts
- func AddRefreshExpiry(conf ExpiryConfig) BuildOpts
- func WithBlocked(blocked bool) BuildOpts
- func WithCreatedAt(createdAt time.Time) BuildOpts
- func WithRefreshExpiry(refreshExpiresAt time.Time) BuildOpts
- func WithRefreshToken(refreshToken string) BuildOpts
- type ExpireUpdate
- type ExpiryConfig
- type FindBy
- type Repository
- type Service
- type Token
- type TokenService
- func (s TokenService) Authenticate(ctx context.Context, accessToken string) (bool, error)
- func (s TokenService) Create(ctx context.Context, clientID string) (Token, error)
- func (s TokenService) Expire(ctx context.Context, accessToken string) error
- func (s TokenService) ReAuthenticate(ctx context.Context, accessToken, refreshToken string) (Token, error)
- func (s TokenService) Revoke(ctx context.Context, accessToken string) (bool, error)
- type TokensRepository
- type UpdateQueryBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAccessBlocked = errors.New("access_blocked")
)
View Source
var (
ErrRefreshTokenExpired = errors.New("refresh_expired")
)
Functions ¶
Types ¶
type BlockedUpdater ¶
type BlockedUpdater struct {
Blocked bool `db:"blocked"`
}
type BuildOpts ¶
func AddAccessExpiry ¶
func AddAccessExpiry(conf ExpiryConfig) BuildOpts
func AddRefreshExpiry ¶
func AddRefreshExpiry(conf ExpiryConfig) BuildOpts
func WithBlocked ¶
func WithCreatedAt ¶
func WithRefreshExpiry ¶
func WithRefreshToken ¶
type ExpireUpdate ¶
type ExpiryConfig ¶
type Repository ¶
type Repository interface{}
type Service ¶
type Service interface { Create(ctx context.Context, clientID string) (Token, error) Revoke(ctx context.Context, accessToken string) (bool, error) Authenticate(ctx context.Context, accessToken string) (bool, error) ReAuthenticate(ctx context.Context, accessToken, refreshToken string) (Token, error) Expire(ctx context.Context, accessToken string) error }
type Token ¶
type Token struct { ClientID string `db:"client_id" validate:"required"` AccessToken string `db:"access_token" validate:"required"` RefreshToken string `db:"refresh_token" validate:"required"` Scopes bob.StringArray `db:"scopes"` Blocked bool `db:"blocked"` ExpiresAt time.Time `db:"expires_at" validate:"required"` RefreshExpiresAt time.Time `db:"refresh_expires_at" validate:"required"` CreatedAt time.Time `db:"created_at" validate:"required"` UpdatedAt time.Time `db:"updated_at" validate:"required"` }
func BuildToken ¶
func (Token) HasExpired ¶
func (Token) HasRefreshExpired ¶
type TokenService ¶
type TokenService struct {
// contains filtered or unexported fields
}
func NewTokenService ¶
func NewTokenService(repo TokensRepository, econf ExpiryConfig) TokenService
func (TokenService) Authenticate ¶
func (TokenService) Expire ¶
func (s TokenService) Expire(ctx context.Context, accessToken string) error
func (TokenService) ReAuthenticate ¶
type TokensRepository ¶
type TokensRepository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *sqlx.DB, qb goqu.DialectWrapper) TokensRepository
func (TokensRepository) Update ¶
func (t TokensRepository) Update(ctx context.Context, builder UpdateQueryBuilder, bargs ...interface{}) error
Click to show internal directories.
Click to hide internal directories.