http

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCookieDomain

func WithCookieDomain(domain string) func(*UserHttpHandler)

WithCookieDomain sets the cookie domain for the UserHttpHandler

func WithSecureCookie

func WithSecureCookie(secure bool) func(*UserHttpHandler)

Types

type User

type User struct {
	UUID          string  `json:"uuid"`
	Username      string  `json:"username"`
	Email         string  `json:"email"`
	Firstname     *string `json:"firstname"`
	Lastname      *string `json:"lastname"`
	EmailVerified bool    `json:"email_verified"`
}

type UserHttpHandler

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

func NewUserHttpHandler

func NewUserHttpHandler(userSrvc user.UserService, jwtKey []byte, options ...func(*UserHttpHandler)) *UserHttpHandler

NewUserHttpHandler creates a new UserHttpHandler with the given user service and JWT key. The cookieDomain parameter is optional and defaults to an empty string if not provided.

func (*UserHttpHandler) ConfirmEmailVerification added in v1.1.0

func (h *UserHttpHandler) ConfirmEmailVerification(w http.ResponseWriter, r *http.Request)

func (*UserHttpHandler) ConfirmPasswordReset added in v1.1.0

func (h *UserHttpHandler) ConfirmPasswordReset(w http.ResponseWriter, r *http.Request)

func (*UserHttpHandler) GetRole

func (httpserver *UserHttpHandler) GetRole(w http.ResponseWriter, r *http.Request)

GetRole returns the role of the currently logged-in user

func (*UserHttpHandler) Login

func (httpserver *UserHttpHandler) Login(w http.ResponseWriter, r *http.Request)

func (*UserHttpHandler) Logout

func (httpserver *UserHttpHandler) Logout(w http.ResponseWriter, r *http.Request)

Logout handles user logout by clearing the auth_token cookie

func (*UserHttpHandler) Register

func (httpserver *UserHttpHandler) Register(w http.ResponseWriter, r *http.Request)

func (*UserHttpHandler) RegisterRoutes

func (h *UserHttpHandler) RegisterRoutes(r *chi.Mux)

func (*UserHttpHandler) RequestEmailVerification added in v1.1.0

func (h *UserHttpHandler) RequestEmailVerification(w http.ResponseWriter, r *http.Request)

func (*UserHttpHandler) RequestPasswordReset added in v1.1.0

func (h *UserHttpHandler) RequestPasswordReset(w http.ResponseWriter, r *http.Request)

func (*UserHttpHandler) WhoAmI

func (h *UserHttpHandler) WhoAmI(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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