timeoutable

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package timeoutable takes care of verifying whether a user session has already expired or not. When a session expires after the configured time, the user will be asked for credentials again, it means, they will be redirected to the sign in page.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler

Middleware ensures that the user's expiry information is kept up-to-date on each request. Deletes the SessionKey from the session if the user is expired (a.ExpireAfter duration since SessionLastAction). This middleware conflicts with use of the Remember module, don't enable both at the same time.

func RefreshExpiry

func RefreshExpiry(w http.ResponseWriter, r *http.Request)

RefreshExpiry updates the last action for the user, so he doesn't become expired.

func TimeToExpiry

func TimeToExpiry(r *http.Request, expireAfter time.Duration) time.Duration

TimeToExpiry returns zero if the user session is expired else the time until expiry. Takes in the allowed idle duration.

Types

type Timeout

type Timeout struct {
	*authboss.Authboss
}

Timeout module

func (*Timeout) Init

func (t *Timeout) Init(ab *authboss.Authboss) error

Init the expire module

This installs a hook into the login process so that the LastAction is recorded immediately.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL