Documentation
¶
Overview ¶
Package auth lets through the requests of a logged-in account only, and tells the routes which one.
Index ¶
Constants ¶
View Source
const Cookie = "notes_session"
Cookie holds the session token of the web app: HttpOnly, page scripts never see it.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New runs next with the account of the request's session in its context: the cookie, or a "Authorization: Bearer <token>" header for scripts, a session token or an API token. Without a valid one, 401.
func SetCookie ¶
func SetCookie(w http.ResponseWriter, token string, expires time.Time)
SetCookie gives the browser the session token until expires; a zero time deletes it. Secure works on http://localhost too: browsers count it as a secure context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.