handlers

package
v0.0.0-...-d67a7ed Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJWT

func ExtractJWT(authToken string) (int, int, error)

ExtractJWT retrieves the token and user ID from the JWT

Types

type Auth

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

Auth-

func NewAuth

func NewAuth(con data.Connection, l hclog.Logger) *Auth

NewAuth-

func (*Auth) IsAuthorized

func (c *Auth) IsAuthorized(next func(userID int, w http.ResponseWriter, r *http.Request)) http.Handler

IsAuthorized

func (*Auth) Login

func (c *Auth) Login(rw http.ResponseWriter, r *http.Request)

Login checks if the user is able to authenticate

func (*Auth) Logout

func (c *Auth) Logout(rw http.ResponseWriter, r *http.Request)

Logout signs out a user and invalidates a JWT token

func (*Auth) VerifyJWT

func (c *Auth) VerifyJWT(authToken string) (int, error)

type AuthResponse

type AuthResponse struct {
	UserID   int    `json:"user_id,omitempty"`
	Username string `json:"username,omitempty"`
	Token    string `json:"token,omitempty"`
}

AuthResponse -

type Health

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

Health is a HTTP Handler for health checking

func NewHealth

func NewHealth(l hclog.Logger, db data.Connection) *Health

NewHealth creates a new Health handler

func (*Health) Liveness

func (h *Health) Liveness(rw http.ResponseWriter, r *http.Request)

Liveness endpoint for health checks indicates server has started

func (*Health) Readiness

func (h *Health) Readiness(rw http.ResponseWriter, r *http.Request)

Readiness endpoint for health checks indicates server is ready to serve traffic

type Team

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

Team -

func NewTeam

func NewTeam(con data.Connection, l hclog.Logger) *Team

NewTeam

func (*Team) CreateTeam

func (c *Team) CreateTeam(_ int, rw http.ResponseWriter, r *http.Request)

CreateTeam creates a new order

func (*Team) DeleteTeam

func (c *Team) DeleteTeam(_ int, rw http.ResponseWriter, r *http.Request)

DeleteTeam deletes a team

func (*Team) GetTeam

func (c *Team) GetTeam(rw http.ResponseWriter, r *http.Request)

GetTeam gets a specific team

func (*Team) GetTeams

func (c *Team) GetTeams(rw http.ResponseWriter, r *http.Request)

GetTeams gets a list of teams in order of speed

func (*Team) GetTeamsByActivation

func (c *Team) GetTeamsByActivation(rw http.ResponseWriter, r *http.Request)

GetTeamsByActivation gets a list of teams by activation in order of speed

func (*Team) ServeHTTP

func (c *Team) ServeHTTP(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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