Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMethodNotAllowed = &ErrorResponse{StatusCode: 405, Message: "Method not allowed, (405)"} ErrNotFound = &ErrorResponse{StatusCode: 404, Message: "Error! Resource not found. (404)"} ErrBadRequest = &ErrorResponse{StatusCode: 400, Message: "Bad request, (400)"} UnAuthorized = &ErrorResponse{StatusCode: 401, Message: "Unauthorized! (401)"} )
Functions ¶
func ValidateSession ¶
ValidateSession and check user has atleast one of the roles. returns WebUserObject object iff session is valid
Types ¶
type Claims ¶
type Claims struct { Id int `json:"id"` // User Id Username string `json:"username"` Password string `json:"password"` jwt.StandardClaims }
Claims struct for jwt token contents
type Credentials ¶
Credentials struct for demarshalling session post body
type ErrorResponse ¶
type ErrorResponse struct { Err error `json:"-"` StatusCode int `json:"-"` StatusText string `json:"status_text"` Message string `json:"message"` }
func ErrorRenderer ¶
func ErrorRenderer(err error) *ErrorResponse
func ServerErrorRenderer ¶
func ServerErrorRenderer(err error) *ErrorResponse
func (*ErrorResponse) Render ¶
func (e *ErrorResponse) Render(w http.ResponseWriter, r *http.Request) error
Click to show internal directories.
Click to hide internal directories.