user

package
v0.0.0-...-6b47566 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthConfig auth.AuthConfig

Functions

func CreateUser

func CreateUser(ctx context.Context, user *User) error

func InitializeUsers

func InitializeUsers()

func MapClaimsToUser

func MapClaimsToUser(claims token.Claims) token.Claims

Called when the Tokens are created/refreshed.

func UserValidator

func UserValidator(token string, claims token.Claims) bool

called on every access to the API

Types

type CtxUserValue

type CtxUserValue struct{}

type User

type User struct {
	gorm.Model       `json:"-"`
	ID               uint                        `gorm:"primarykey"`
	Email            string                      `validate:"required,email"`
	FirstName        string                      `validate:"required"`
	LastName         string                      `validate:"required"`
	Password         string                      `json:"-" writeOnly:"true" validate:"required"`
	TransportConfigs []transport.TransportConfig `json:"transports,omitempty" gorm:"many2many:user_transports;" validate:"-"`
}

func GetUser

func GetUser(ctx context.Context, email string) (user *User, err error)

func GetUserByID

func GetUserByID(ctx context.Context, id uint) (user *User, err error)

func GetUserFromContext

func GetUserFromContext(ctx context.Context) (bool, *User)

func GetUsers

func GetUsers(ctx context.Context) []User

func (*User) CheckPassword

func (u *User) CheckPassword(ctx context.Context, password string) bool

func (User) ProcessMessage

func (u User) ProcessMessage(ctx context.Context, msg msg.Message) (err error)

func (*User) SetPassword

func (u *User) SetPassword(ctx context.Context, password string) error

Jump to

Keyboard shortcuts

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