authenticator

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccessToken

func CreateAccessToken(id int, uid uuid.UUID) (string, error)

func ExtractUserIDFromToken

func ExtractUserIDFromToken(accessToken string) (int, uuid.UUID, error)

Types

type AuthClaims

type AuthClaims struct {
	User   int       `json:"user"`
	UUID   uuid.UUID `json:"uuid"`
	Random string    `json:"rnd"`
	jwt.RegisteredClaims
}

type Authenticator

type Authenticator struct {
	Storage *model.Storage
}

func NewAuthenticator

func NewAuthenticator(storage *model.Storage) *Authenticator

func (*Authenticator) JWTAuth

func (a *Authenticator) JWTAuth() gin.HandlerFunc

func (*Authenticator) ManualAuth

func (a *Authenticator) ManualAuth(accessToken string) (bool, error)

func (*Authenticator) ValidateAccessToken

func (a *Authenticator) ValidateAccessToken(accessToken string) (bool, error)

func (*Authenticator) ValidateUser

func (a *Authenticator) ValidateUser(id int, uid uuid.UUID) (bool, error)

Jump to

Keyboard shortcuts

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