Versions in this module Expand all Collapse all v1 v1.0.0 Apr 17, 2018 Changes in this version + const ConfirmPrefix + const CookieRemember + const FlashErrorKey + const FlashSuccessKey + const SessionHalfAuthKey + const SessionKey + const SessionLastAction + const SessionOAuth2Params + const SessionOAuth2State + const StoreEmail + const StoreOAuth2Expiry + const StoreOAuth2Provider + const StoreOAuth2Refresh + const StoreOAuth2Token + const StoreOAuth2UID + const StorePassword + const StoreUsername + var ErrTokenNotFound = errors.New("Token not found") + var ErrUserFound = errors.New("User found") + var ErrUserNotFound = errors.New("User not found") + var FormValueOAuth2State = "state" + var FormValueRedirect = "redir" + func RegisterModule(name string, m Modularizer) + func RegisteredModules() []string + type After func(*Context) error + type AttributeErr struct + GotKind string + Name string + WantKind DataType + func NewAttributeErr(name string, kind DataType, val interface{}) AttributeErr + func (a AttributeErr) Error() string + type AttributeMeta map[string]DataType + func (a AttributeMeta) Names() []string + type Attributes map[string]interface + func (a Attributes) Bind(strct interface{}, ignoreMissing bool) error + func (a Attributes) Bool(key string) (val bool, ok bool) + func (a Attributes) BoolErr(key string) (val bool, err error) + func (a Attributes) DateTime(key string) (time.Time, bool) + func (a Attributes) DateTimeErr(key string) (val time.Time, err error) + func (a Attributes) Int64(key string) (int64, bool) + func (a Attributes) Int64Err(key string) (val int64, err error) + func (a Attributes) Names() []string + func (a Attributes) String(key string) (string, bool) + func (a Attributes) StringErr(key string) (val string, err error) + func AttributesFromRequest(r *http.Request) (Attributes, error) + func Unbind(intf interface{}) Attributes + type Authapi struct + Callbacks *Callbacks + ModuleAttributes AttributeMeta + func New() *Authapi + func (a *Authapi) CurrentUser(w http.ResponseWriter, r *http.Request) (interface{}, error) + func (a *Authapi) CurrentUserP(w http.ResponseWriter, r *http.Request) interface{} + func (a *Authapi) ExpireMiddleware(next http.Handler) http.Handler + func (a *Authapi) FlashError(w http.ResponseWriter, r *http.Request) string + func (a *Authapi) FlashSuccess(w http.ResponseWriter, r *http.Request) string + func (a *Authapi) Init(modulesToLoad ...string) error + func (a *Authapi) InitContext(w http.ResponseWriter, r *http.Request) *Context + func (a *Authapi) IsLoaded(mod string) bool + func (a *Authapi) LoadedModules() []string + func (a *Authapi) NewContext() *Context + func (a *Authapi) NewRouter() http.Handler + func (a *Authapi) RefreshExpiry(w http.ResponseWriter, r *http.Request) + func (a *Authapi) SendMail(data Email) error + func (a *Authapi) TimeToExpiry(w http.ResponseWriter, r *http.Request) time.Duration + func (a *Authapi) UpdatePassword(w http.ResponseWriter, r *http.Request, ptPassword string, user interface{}, ...) error + type Before func(*Context) (Interrupt, error) + type Callbacks struct + func NewCallbacks() *Callbacks + func (c *Callbacks) After(e Event, f After) + func (c *Callbacks) Before(e Event, f Before) + func (c *Callbacks) FireAfter(e Event, ctx *Context) (err error) + func (c *Callbacks) FireBefore(e Event, ctx *Context) (interrupt Interrupt, err error) + type ClientDataErr struct + Name string + func (c ClientDataErr) Error() string + type ClientStorer interface + Del func(key string) + Get func(key string) (string, bool) + Put func(key, value string) + type ClientStorerErr interface + GetErr func(key string) (string, error) + type Config struct + AllowInsecureLoginAfterConfirm bool + AllowLoginAfterResetPassword bool + BCryptCost int + BadRequestHandler http.Handler + ConfirmFields []string + ContextProvider func(*http.Request) context.Context + CookieStoreMaker CookieStoreMaker + EmailFrom string + EmailFromName string + EmailSubjectPrefix string + ErrorHandler http.Handler + ExpireAfter time.Duration + LayoutHTMLEmail *template.Template + LayoutTextEmail *template.Template + LockAfter int + LockDuration time.Duration + LockWindow time.Duration + LogWriteMaker LogWriteMaker + LogWriter io.Writer + MailMaker MailMaker + Mailer Mailer + MountPath string + NotFoundHandler http.Handler + OAuth2Providers map[string]OAuth2Provider + OAuth2StoreMaker OAuth2StoreMaker + OAuth2Storer OAuth2Storer + Policies []Validator + PrimaryID string + RecoverTokenDuration time.Duration + RootURL string + SessionStoreMaker SessionStoreMaker + SiteURL string + StoreMaker StoreMaker + Storer Storer + ViewsPath string + XSRFMaker XSRF + XSRFName string + func (c *Config) Defaults() + type Context struct + CookieStorer ClientStorerErr + SessionStorer ClientStorerErr + User Attributes + Values map[string]string + func (c *Context) LoadSessionUser() error + func (c *Context) LoadUser(key string) error + func (c *Context) SaveUser() error + type CookieStoreMaker func(http.ResponseWriter, *http.Request) ClientStorer + type DataType int + const Bool + const DateTime + const Integer + const String + func (d DataType) String() string + type DefaultLogger log.Logger + func NewDefaultLogger() *DefaultLogger + func (d *DefaultLogger) Write(b []byte) (int, error) + type Email struct + Bcc []string + BccNames []string + Cc []string + CcNames []string + From string + FromName string + HTMLBody string + ReplyTo string + ReplyToName string + Subject string + TextBody string + To []string + ToNames []string + type ErrAndRedirect struct + Err error + FlashError string + FlashSuccess string + Location string + func (e ErrAndRedirect) Error() string + type ErrorList []error + func Validate(r *http.Request, ruleset []Validator, confirmFields ...string) ErrorList + func (e ErrorList) Error() string + func (e ErrorList) Map() map[string][]string + type Event int + const EventAuth + const EventAuthFail + const EventGetUser + const EventGetUserSession + const EventOAuth + const EventOAuthFail + const EventPasswordReset + const EventRecoverEnd + const EventRecoverStart + const EventRegister + func (i Event) String() string + type FieldError struct + Err error + Name string + func (f FieldError) Error() string + type HandlerFunc func(*Context, http.ResponseWriter, *http.Request) error + type Interrupt int + const InterruptAccountLocked + const InterruptAccountNotConfirmed + const InterruptNone + const InterruptSessionExpired + func (i Interrupt) String() string + type LogWriteMaker func(http.ResponseWriter, *http.Request) io.Writer + type MailMaker func(http.ResponseWriter, *http.Request) Mailer + type Mailer interface + Send func(Email) error + func LogMailer(writer io.Writer) Mailer + func SMTPMailer(server string, auth smtp.Auth) Mailer + type Modularizer interface + Initialize func(*Authapi) error + Routes func() RouteTable + Storage func() StorageOptions + type OAuth2Provider struct + AdditionalParams url.Values + Callback func(context.Context, oauth2.Config, *oauth2.Token) (Attributes, error) + OAuth2Config *oauth2.Config + type OAuth2StoreMaker func(http.ResponseWriter, *http.Request) OAuth2Storer + type OAuth2Storer interface + GetOAuth func(uid, provider string) (interface{}, error) + PutOAuth func(uid, provider string, attr Attributes) error + type RenderErr struct + Data interface{} + Err error + TemplateName string + func (r RenderErr) Error() string + type RouteTable map[string]HandlerFunc + type Rules struct + AllowWhitespace bool + FieldName string + MatchError string + MaxLength int + MinLength int + MinLetters int + MinLower int + MinNumeric int + MinSymbols int + MinUpper int + MustMatch *regexp.Regexp + Required bool + func (r Rules) Errors(toValidate string) ErrorList + func (r Rules) Field() string + func (r Rules) IsValid(toValidate string) bool + func (r Rules) Rules() []string + type SessionStoreMaker func(http.ResponseWriter, *http.Request) ClientStorer + type StorageOptions map[string]DataType + type StoreMaker func(http.ResponseWriter, *http.Request) Storer + type Storer interface + Get func(key string) (interface{}, error) + Put func(key string, attr Attributes) error + type Validator interface + Errors func(in string) ErrorList + Field func() string + Rules func() []string + func FilterValidators(validators []Validator, fields ...string) []Validator + type XSRF func(http.ResponseWriter, *http.Request) (token string)