Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiV1Controller ¶
type ApiV1Controller struct {
beego.Controller
}
func (*ApiV1Controller) RateLimiter ¶
func (a *ApiV1Controller) RateLimiter()
Show an example of API rate limiting @router /rate-limiter/ [get]
func (*ApiV1Controller) Websocket ¶
func (a *ApiV1Controller) Websocket()
Return the number of all connected clients and rooms @router /websocket-status/ [get]
type CustomClaims ¶
type CustomClaims struct { Username string `json:"username"` Role string `json:"role"` jwt.StandardClaims }
CustomClaims a structure to add custom fields to JWT's claim
func ValidateToken ¶
func ValidateToken(tokenString string) (bool, *CustomClaims)
ValidateToken validates a JWT token Returns True and the Claim value uppon successful validation, false & empty CustomClaim otherwise NOTE: its uppon to you to check if the token is expired.
type LoginController ¶
type LoginController struct {
beego.Controller
}
func (*LoginController) Login ¶
func (lc *LoginController) Login()
@Title login @Description logs in a user @Success 200 {string} @Failure 400 bad request @router /login/ [post]
func (*LoginController) ShowLoginTemplate ¶
func (lc *LoginController) ShowLoginTemplate()
@Title ShowLoginTemplate @Description showl the login template/form @Success 200 {string} @Failure 400 bad request @router /login/ [get]
type MainController ¶
type MainController struct {
beego.Controller
}
func (*MainController) Get ¶
func (c *MainController) Get()
type RegistrationController ¶
type RegistrationController struct {
beego.Controller
}
func (*RegistrationController) Register ¶
func (rc *RegistrationController) Register()
@Title register @Description register a new user @Success 200 {string} @Failure 400 body is empty @router /register/ [post]
type TokenController ¶
type TokenController struct {
beego.Controller
}
func (*TokenController) GetToken ¶
func (tc *TokenController) GetToken()
@Title GetToken @Description issues a new JWT token upon client authentication @Param username body string true "user's name" @Param password body string true "user's password" @Success 200 {string} @Failure 400 body is empty @router /api/get-token/ [post]
type WebsocketController ¶
type WebsocketController struct {
beego.Controller
}
func (*WebsocketController) Get ¶
func (wc *WebsocketController) Get()
Live a WebSocket controller - upgrader