Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithPayload ¶
ContextWithPayload adds a payload to a context.
func ResponseWithTokenCookie ¶
func ResponseWithTokenCookie(w http.ResponseWriter, p *Payload) error
ResponseWithTokenCookie adds a cookie to a response with the provided payload's token.
Types ¶
type InsertUser ¶
type InsertUser struct { Name string `bson:"name"` Username string `bson:"username"` Email string `bson:"email"` Password string `bson:"password"` CreatedAt time.Time `bson:"createdAt"` }
InsertUser is an user to be inserted in the database.
type Payload ¶
Payload is the user data that can used in a token.
func PayloadFromContext ¶
PayloadFromContext gets a payload from a context.
func PayloadFromToken ¶
PayloadFromToken gets a payload from a token. If the token is invalid, or any other error occurs, a nil pointer is returned.
func PayloadFromTokenCookie ¶
PayloadFromTokenCookie gets a payload from a request's token cookie. If the cookie doesn't exist, or any other error occurs, a nil pointer is returned.
func PayloadFromUser ¶
PayloadFromUser gets a payload from an user.
Click to show internal directories.
Click to hide internal directories.