Back to godoc.org

Package router

v0.0.0-...-1be06eb
Latest Go to latest

The highest tagged major version is .

Published: Jul 7, 2020 | License: MIT | Module: github.com/Depado/vuemonit

Index

func Run

func Run(r *Router, c *cmd.Conf)

type CredentialQuery

type CredentialQuery struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (CredentialQuery) ValidateLogin

func (c CredentialQuery) ValidateLogin() error

func (CredentialQuery) ValidateRegister

func (c CredentialQuery) ValidateRegister() error

type HealthCheck

type HealthCheck struct {
	URL   string        `json:"url"`
	Every time.Duration `json:"every"`
}

type RefreshQuery

type RefreshQuery struct {
	RefreshToken string `json:"refresh_token"`
}

func (RefreshQuery) Validate

func (r RefreshQuery) Validate() error

type Router

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

func NewRouter

func NewRouter(c *cmd.Conf, e *gin.Engine, log *zerolog.Logger, lh interactor.LogicHandler) *Router

func (Router) AuthRequired

func (r Router) AuthRequired() gin.HandlerFunc

AuthRequired is a middleware to simply check if a user is logged-in or not This middleware will check both the cookie and the Authorization header, allowing users to provide their authentication tokens the way they like In the case of a cookie based authentication, if the access token is expired this middleware will silently refresh the tokens as to avoid unnecessary calls

func (Router) GetService

func (r Router) GetService(c *gin.Context)

func (Router) GetServices

func (r Router) GetServices(c *gin.Context)

func (Router) GetTimedResponses

func (r Router) GetTimedResponses(c *gin.Context)

GetTimedResponses is the endpoint in charge of retrieving timed responses

func (Router) Login

func (r Router) Login(c *gin.Context)

Login is the route used to login a user. This will generate both a short lived access token and long lived refresh token This endpoint will send back both a cookie and a JSON containing those tokens and thus can be used to login both on the frontend app and a standard http client

func (Router) Logout

func (r Router) Logout(c *gin.Context)

Logout will return an invalidated cookie, effectively disabling the cookie that was already present in the browser, if any

func (Router) Me

func (r Router) Me(c *gin.Context)

func (Router) PostService

func (r Router) PostService(c *gin.Context)

func (Router) Refresh

func (r Router) Refresh(c *gin.Context)

Refresh is the route used to refresh the access token, given a valid refresh token. This route should not be used by the frontend application since the cookie based authentication does silent refreshes when needed

func (Router) Register

func (r Router) Register(c *gin.Context)

Register will allow a new user to register

func (Router) SetRoutes

func (r Router) SetRoutes()

SetRoutes will setup the various served routes

func (Router) SetupEmbeddedFront

func (r Router) SetupEmbeddedFront()

func (Router) TailTimedResponses

func (r Router) TailTimedResponses(c *gin.Context)

type ServiceQuery

type ServiceQuery struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	HealthCheck `json:"healthcheck"`
}

func (ServiceQuery) Validate

func (s ServiceQuery) Validate() error

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier