remember

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package remember implements persistent logins using cookies

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(ab *authboss.Authboss, w http.ResponseWriter, req **http.Request) error

Authenticate the user using their remember cookie. If the cookie proves unusable it will be deleted. A cookie may be unusable for the following reasons: - Can't decode the base64 - Invalid token format - Can't find token in DB

In order to authenticate it adds to the request context as well as to the cookie and session states.

func GenerateToken

func GenerateToken(pid string) (hash string, token string, err error)

GenerateToken creates a remember me token

func Middleware

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

Middleware automatically authenticates users if they have remember me tokens If the user has been loaded already, it returns early

Types

type Remember

type Remember struct {
	*authboss.Authboss
}

Remember module

func (*Remember) AfterPasswordReset

func (r *Remember) AfterPasswordReset(w http.ResponseWriter, req *http.Request, handled bool) (bool, error)

AfterPasswordReset is called after the password has been reset, since it should invalidate all tokens associated to that user.

func (*Remember) Init

func (r *Remember) Init(ab *authboss.Authboss) error

Init module

func (*Remember) RememberAfterAuth

func (r *Remember) RememberAfterAuth(w http.ResponseWriter, req *http.Request, handled bool) (bool, error)

RememberAfterAuth creates a remember token and saves it in the user's cookies.

Jump to

Keyboard shortcuts

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