usergrp

package
v0.0.0-...-2e936b0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLoginUser

type AppLoginUser struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required,len=8"`
}

AppLoginUser what we require from user to login.

func (AppLoginUser) Validate

func (app AppLoginUser) Validate() error

Validate checks the data in the model is considered clean.

type AppNewUser

type AppNewUser struct {
	Name     string   `json:"username" validate:"required,min=3,max=64"`
	Password string   `json:"password" validate:"required,min=8,max=256"`
	Roles    []string `json:"roles" validate:"required,dive,oneof=USER ADMIN"`
}

AppNewUser what we require from user to add new user.

func (AppNewUser) Validate

func (app AppNewUser) Validate() error

Validate checks the data in the model is considered clean.

type AppUser

type AppUser struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	PasswordHash []byte   `json:"-"`
	Roles        []string `json:"roles"`
	DateCreated  string   `json:"date_created"`
}

AppUser represents application user.

type UserHandler

type UserHandler struct {
	Logger *logger.Logger
	Users  user.Usecase
	Auth   auth.Auth
}

func (*UserHandler) GetByID

GetByID returns a user bu its ID.

func (*UserHandler) List

List returns a list of users.

func (*UserHandler) Login

Login logins to the app with given credentials and returns JWT token.

func (*UserHandler) Register

func (h *UserHandler) Register(ctx context.Context, w http.ResponseWriter, r *http.Request) error

Register adds new user to the app.

Jump to

Keyboard shortcuts

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