Documentation
¶
Index ¶
- Constants
- Variables
- func ClearCookie(w http.ResponseWriter)
- func Create(ctx context.Context, db *gorm.DB, in Input) (string, *schema.Session, error)
- func Get(ctx context.Context, db *gorm.DB, r *http.Request) (*schema.Session, error)
- func Purge(ctx context.Context, db *gorm.DB) error
- func Revoke(ctx context.Context, db *gorm.DB, r *http.Request) error
- func SetCookie(w http.ResponseWriter, raw string, expires time.Time)
- type Input
Constants ¶
View Source
const ( CookieName = "salmon_session" TTL = 12 * time.Hour )
Variables ¶
View Source
var ( ErrSessionExpired = errors.New("session expired") ErrNoSession = errors.New("no session") )
View Source
var SecureCookies = true
SecureCookies controls the Secure attribute of the session cookie. It is only ever turned off for plain-http local development (see server.New).
Functions ¶
func ClearCookie ¶
func ClearCookie(w http.ResponseWriter)
ClearCookie tells the browser to drop the session cookie.
func Create ¶
Create establishes a new authenticated session. The returned string is the raw cookie value; only its digest is persisted, so a database dump does not hand over live sessions.
Types ¶
Click to show internal directories.
Click to hide internal directories.