svr

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AccessTokenExpires int64 = 60 * 60 * 24 * 30
	RefreshToken       int64 = 24 * 30
)
View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type MemoryStorage

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

func (*MemoryStorage) GetAccess

func (ms *MemoryStorage) GetAccess(access string) (clientId string, err error)

func (*MemoryStorage) GetCode

func (ms *MemoryStorage) GetCode(code string) (clientId string, err error)

func (*MemoryStorage) GetRefresh

func (ms *MemoryStorage) GetRefresh(refresh string) (clientId string, err error)

func (*MemoryStorage) RemoveAccess

func (ms *MemoryStorage) RemoveAccess(access string) error

func (*MemoryStorage) RemoveCode

func (ms *MemoryStorage) RemoveCode(code string) error

func (*MemoryStorage) RemoveRefresh

func (ms *MemoryStorage) RemoveRefresh(refresh string) error

func (*MemoryStorage) SaveAccess

func (ms *MemoryStorage) SaveAccess(access string, clientId string) (err error)

func (*MemoryStorage) SaveCode

func (ms *MemoryStorage) SaveCode(code string, clientId string) (err error)

func (*MemoryStorage) SaveRefresh

func (ms *MemoryStorage) SaveRefresh(refresh string, clientId string) (err error)

type Storage

type Storage interface {
	RemoveCode(code string) error

	RemoveAccess(access string) error

	RemoveRefresh(refresh string) error

	GetCode(code string) (clientId string, err error)

	GetAccess(access string) (clientId string, err error)

	GetRefresh(refresh string) (clientId string, err error)

	SaveCode(code string, clientId string) (err error)

	SaveAccess(access string, clientId string) (err error)

	SaveRefresh(refresh string, clientId string) (err error)
}

func NewMemStorage

func NewMemStorage() (s Storage)

type TokenInfo

type TokenInfo struct {
	AccessToken         string
	RefreshToken        string
	AccessTokenExpires  int64
	RefreshTokenExpires int64
}

func GenCredentialToken

func GenCredentialToken(data model.CredentialsApp, provider *token.JwtProvider) (ti TokenInfo, err error)

Jump to

Keyboard shortcuts

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