access

package
v0.0.0-...-e46c3b8 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrInvalSyncToken

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

ErrInvalSyncToken is used for reporting that a sync token is invalid.

func (ErrInvalSyncToken) Context

func (err ErrInvalSyncToken) Context() ctxerr.Context

Context returns error Context.

func (ErrInvalSyncToken) Error

func (err ErrInvalSyncToken) Error() string

func (ErrInvalSyncToken) HttpStatusCode

func (err ErrInvalSyncToken) HttpStatusCode() int

HttpStatusCode returns http status code for the error.

func (ErrInvalSyncToken) Text

func (err ErrInvalSyncToken) Text() string

Text returns human readable error text.

func (ErrInvalSyncToken) Unwrap

func (err ErrInvalSyncToken) Unwrap() error

type Service

type Service interface {
	GrantAccess(ctx context.Context, user model.User) (*Token, int64, ctxerr.Error)
	RemExpired(ctx context.Context) ctxerr.Error
	RefreshAccess(ctx context.Context, refresh SyncToken) (model.Access, *SyncToken, int64, ctxerr.Error)
	RevokeAccess(ctx context.Context, refresh SyncToken) ctxerr.Error
	DecodeAndValidateAccessToken(access SyncToken) (*TokenData, ctxerr.Error)
}

Service abstracts the access service.

func Use

func Use(repo repo.AccessRepo, logger *zap.Logger, refreshSecret []byte, accessSecret []byte) Service

Use creates an access Service.

type SyncToken

type SyncToken struct {
	Token string
	Sync  string
}

SyncToken is pair of PASETO token and synchronization token.

type Token

type Token struct {
	Access  SyncToken
	Refresh SyncToken
}

Token is pair of access and refresh SyncTokens.

type TokenData

type TokenData struct {
	TokenID  uuid.UUID
	UserID   uuid.UUID
	IssuedAt time.Time
}

TokenData is the data obtained from validating and decoding SyncToken.

Jump to

Keyboard shortcuts

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