callbacks

package
v0.0.0-...-a757527 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// MessageTokenRejected is displayed when a token handed back from Google has been rejected
	// for some reason, often due to an Audience or Domain mismatch
	MessageTokenRejected = "The token received was rejected, make sure you signed in with the right account."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieCallbacks

type CookieCallbacks struct {
	// contains filtered or unexported fields
}

CookieCallbacks set stuff in cookies

func NewCookiesCallbacks

func NewCookiesCallbacks(secure bool) *CookieCallbacks

NewCookiesCallbacks creates a new CookieCallbacks instance

func (*CookieCallbacks) OnError

func (c *CookieCallbacks) OnError(w http.ResponseWriter, err error)

OnError return an internal server eror status

func (*CookieCallbacks) OnInvalidToken

func (c *CookieCallbacks) OnInvalidToken(w http.ResponseWriter, err error)

OnInvalidToken returns an invalid token status

func (*CookieCallbacks) OnRefresh

func (c *CookieCallbacks) OnRefresh(w http.ResponseWriter, token string) error

OnRefresh writes the new token to the X-Google-Id header

func (*CookieCallbacks) OnSuccess

func (c *CookieCallbacks) OnSuccess(w http.ResponseWriter, location, token string, claims *verifier.StandardClaims)

OnSuccess writes the new token to local storage and redirects to a given location

func (*CookieCallbacks) WithErrorTemplate

func (c *CookieCallbacks) WithErrorTemplate(template *template.Template) *CookieCallbacks

WithErrorTemplate allows you to override the default error template

func (*CookieCallbacks) WithKey

func (c *CookieCallbacks) WithKey(key string) *CookieCallbacks

WithKey allows you to override the default cookie key used to persist the token

func (*CookieCallbacks) WithPath

func (c *CookieCallbacks) WithPath(path string) *CookieCallbacks

WithPath allows you to override the default path used to store the cookie

type LocalStorageCallbacks

type LocalStorageCallbacks struct {
	// contains filtered or unexported fields
}

LocalStorageCallbacks are used for storing identity tokens in local storage, this requires that the oauth handlers be in the same subdomain as the frontend that is authenticating

func NewLocalStorageCallbacks

func NewLocalStorageCallbacks() *LocalStorageCallbacks

NewLocalStorageCallbacks creates a new LocalStorageCallbacks instance

func (*LocalStorageCallbacks) OnError

func (c *LocalStorageCallbacks) OnError(w http.ResponseWriter, err error)

OnError return an internal server eror status

func (*LocalStorageCallbacks) OnInvalidToken

func (c *LocalStorageCallbacks) OnInvalidToken(w http.ResponseWriter, err error)

OnInvalidToken returns an invalid token status

func (*LocalStorageCallbacks) OnRefresh

func (c *LocalStorageCallbacks) OnRefresh(w http.ResponseWriter, token string) error

OnRefresh writes the new token to the X-Google-Id header

func (*LocalStorageCallbacks) OnSuccess

func (c *LocalStorageCallbacks) OnSuccess(w http.ResponseWriter, location, token string, claims *verifier.StandardClaims)

OnSuccess writes the new token to local storage and redirects to a given location

func (*LocalStorageCallbacks) WithErrorTemplate

func (c *LocalStorageCallbacks) WithErrorTemplate(template *template.Template) *LocalStorageCallbacks

WithErrorTemplate allows you to override the default error template

func (*LocalStorageCallbacks) WithHeaderKey

func (c *LocalStorageCallbacks) WithHeaderKey(key string) *LocalStorageCallbacks

WithHeaderKey allows you to override the default header used to indicate a token refresh

func (*LocalStorageCallbacks) WithKey

WithKey allows you to override the default localStorage key used to persist the token

Jump to

Keyboard shortcuts

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