Documentation ¶
Index ¶
- func Run(r *Router, c *cmd.Conf)
- type CredentialQuery
- type HealthCheck
- type RefreshQuery
- type Router
- func (r Router) AuthRequired() gin.HandlerFunc
- func (r Router) GetService(c *gin.Context)
- func (r Router) GetServices(c *gin.Context)
- func (r Router) GetTimedResponses(c *gin.Context)
- func (r Router) Login(c *gin.Context)
- func (r Router) Logout(c *gin.Context)
- func (r Router) Me(c *gin.Context)
- func (r Router) PostService(c *gin.Context)
- func (r Router) Refresh(c *gin.Context)
- func (r Router) Register(c *gin.Context)
- func (r Router) SetRoutes()
- func (r Router) SetupEmbeddedFront()
- func (r Router) TailTimedResponses(c *gin.Context)
- type ServiceQuery
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CredentialQuery ¶
func (CredentialQuery) ValidateLogin ¶
func (c CredentialQuery) ValidateLogin() error
func (CredentialQuery) ValidateRegister ¶
func (c CredentialQuery) ValidateRegister() error
type HealthCheck ¶
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 (Router) GetServices ¶
func (Router) GetTimedResponses ¶
GetTimedResponses is the endpoint in charge of retrieving timed responses
func (Router) Login ¶
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 ¶
Logout will return an invalidated cookie, effectively disabling the cookie that was already present in the browser, if any
func (Router) PostService ¶
func (Router) Refresh ¶
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) SetRoutes ¶
func (r Router) SetRoutes()
SetRoutes will setup the various served routes
func (Router) SetupEmbeddedFront ¶
func (r Router) SetupEmbeddedFront()
func (Router) TailTimedResponses ¶
type ServiceQuery ¶
type ServiceQuery struct { Name string `json:"name"` Description string `json:"description"` HealthCheck `json:"healthcheck"` }
func (ServiceQuery) Validate ¶
func (s ServiceQuery) Validate() error