auth

package
v0.0.0-...-f5e8e9b Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const UserContextKey = contextKey("user")

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	GeneratePassword(password string) (string, error)
	ComparePassword(password, hash string) (bool, error)
	CreateToken(user models.User) (string, error)
	ValidateToken(tokenString string) (models.User, error)
	NewUser(id string, name string) models.User
}

func NewAuth

func NewAuth() Auth

type Claims

type Claims struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	jwt.StandardClaims
}

func (*Claims) GetID

func (c *Claims) GetID() string

func (*Claims) GetName

func (c *Claims) GetName() string

type NewUser

type NewUser struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

func (*NewUser) GetID

func (user *NewUser) GetID() string

func (*NewUser) GetName

func (user *NewUser) GetName() string

type PasswordConfig

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

Jump to

Keyboard shortcuts

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