Documentation
¶
Index ¶
- type Collection
- type Controller
- func (auth *Controller) AdminOnly(app *application.App, w http.ResponseWriter, r *http.Request) bool
- func (auth *Controller) Authenticate(r *http.Request) (*User, *Session, error)
- func (auth *Controller) CurrentSession() *Session
- func (auth *Controller) CurrentUser() *User
- func (auth *Controller) Forward(name, to string) http.HandlerFunc
- func (auth Controller) Handle(r *http.Request) application.Controller
- func (auth Controller) HandleSignin(w http.ResponseWriter, r *http.Request)
- func (auth Controller) HandleSignout(w http.ResponseWriter, r *http.Request)
- func (auth Controller) HandleSignup(w http.ResponseWriter, r *http.Request)
- func (auth *Controller) Optional(app *application.App, w http.ResponseWriter, r *http.Request) bool
- func (auth *Controller) Protect(fn http.Handler, adminOnly bool) http.HandlerFunc
- func (auth *Controller) ProtectFunc(h http.HandlerFunc, adminOnly bool) http.Handler
- func (auth *Controller) Required(app *application.App, w http.ResponseWriter, r *http.Request) bool
- func (auth *Controller) Serve(name string, adminOnly bool) http.Handler
- func (auth *Controller) Setup(app *application.App)
- type Option
- func WithCookie(name string) Option
- func WithSetupView(view, dest string) Option
- func WithSigninHandler(fn func(*Controller, *User) http.HandlerFunc) Option
- func WithSigninView(view, dest string) Option
- func WithSignoutURL(url string) Option
- func WithSignupHandler(fn func(*Controller, *User) http.HandlerFunc) Option
- type Session
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
Users *database.Collection[*User]
Sessions *database.Collection[*Session]
// contains filtered or unexported fields
}
func Manage ¶
func Manage(db *database.DynamicDB) *Collection
func (*Collection) Controller ¶
func (c *Collection) Controller(opts ...Option) *Controller
type Controller ¶
type Controller struct {
application.BaseController
*Collection
// contains filtered or unexported fields
}
func (*Controller) AdminOnly ¶
func (auth *Controller) AdminOnly(app *application.App, w http.ResponseWriter, r *http.Request) bool
func (*Controller) Authenticate ¶
func (*Controller) CurrentSession ¶
func (auth *Controller) CurrentSession() *Session
func (*Controller) CurrentUser ¶
func (auth *Controller) CurrentUser() *User
func (*Controller) Forward ¶
func (auth *Controller) Forward(name, to string) http.HandlerFunc
func (Controller) Handle ¶
func (auth Controller) Handle(r *http.Request) application.Controller
func (Controller) HandleSignin ¶
func (auth Controller) HandleSignin(w http.ResponseWriter, r *http.Request)
func (Controller) HandleSignout ¶
func (auth Controller) HandleSignout(w http.ResponseWriter, r *http.Request)
func (Controller) HandleSignup ¶
func (auth Controller) HandleSignup(w http.ResponseWriter, r *http.Request)
func (*Controller) Optional ¶
func (auth *Controller) Optional(app *application.App, w http.ResponseWriter, r *http.Request) bool
func (*Controller) Protect ¶
func (auth *Controller) Protect(fn http.Handler, adminOnly bool) http.HandlerFunc
func (*Controller) ProtectFunc ¶
func (auth *Controller) ProtectFunc(h http.HandlerFunc, adminOnly bool) http.Handler
func (*Controller) Required ¶
func (auth *Controller) Required(app *application.App, w http.ResponseWriter, r *http.Request) bool
func (*Controller) Setup ¶
func (auth *Controller) Setup(app *application.App)
type Option ¶
type Option func(*Controller)
func WithCookie ¶
func WithSetupView ¶
func WithSigninHandler ¶
func WithSigninHandler(fn func(*Controller, *User) http.HandlerFunc) Option
func WithSigninView ¶
func WithSignoutURL ¶
func WithSignupHandler ¶
func WithSignupHandler(fn func(*Controller, *User) http.HandlerFunc) Option
Click to show internal directories.
Click to hide internal directories.