Documentation ¶
Index ¶
- Constants
- type CookieCallbacks
- func (c *CookieCallbacks) OnError(w http.ResponseWriter, err error)
- func (c *CookieCallbacks) OnInvalidToken(w http.ResponseWriter, err error)
- func (c *CookieCallbacks) OnRefresh(w http.ResponseWriter, token string) error
- func (c *CookieCallbacks) OnSuccess(w http.ResponseWriter, location, token string, claims *verifier.StandardClaims)
- func (c *CookieCallbacks) WithErrorTemplate(template *template.Template) *CookieCallbacks
- func (c *CookieCallbacks) WithKey(key string) *CookieCallbacks
- func (c *CookieCallbacks) WithPath(path string) *CookieCallbacks
- type LocalStorageCallbacks
- func (c *LocalStorageCallbacks) OnError(w http.ResponseWriter, err error)
- func (c *LocalStorageCallbacks) OnInvalidToken(w http.ResponseWriter, err error)
- func (c *LocalStorageCallbacks) OnRefresh(w http.ResponseWriter, token string) error
- func (c *LocalStorageCallbacks) OnSuccess(w http.ResponseWriter, location, token string, claims *verifier.StandardClaims)
- func (c *LocalStorageCallbacks) WithErrorTemplate(template *template.Template) *LocalStorageCallbacks
- func (c *LocalStorageCallbacks) WithHeaderKey(key string) *LocalStorageCallbacks
- func (c *LocalStorageCallbacks) WithKey(key string) *LocalStorageCallbacks
Constants ¶
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 ¶
func (c *LocalStorageCallbacks) WithKey(key string) *LocalStorageCallbacks
WithKey allows you to override the default localStorage key used to persist the token