authboss

package
v0.0.0-...-4953ef6 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetCsrfToken = func(r *http.Request) string {
	return nosurf.Token(r)
}

GetCsrfToken gets the csrf token that authboss adds to HTMLData

Functions

This section is empty.

Types

type Authboss

type Authboss struct {
	*authboss.Authboss

	// For module middlewares
	ExtraDefaultMiddlewares []func(http.Handler) http.Handler
	ExtraProtectMiddlewares []func(http.Handler) http.Handler
}

Authboss satisfies the Auth interface Based on the excellent package github.com/volatiletech/authboss

func (Authboss) AddUserIDToContext

func (a Authboss) AddUserIDToContext(handler http.Handler) http.Handler

AddUserIDToContext is a middleware that adds some auth related values to context

func (Authboss) DataInjector

func (a Authboss) DataInjector(handler http.Handler) http.Handler

DataInjector is a middleware that adds some auth related values to context

func (Authboss) DefaultMiddlewares

func (a Authboss) DefaultMiddlewares() []func(http.Handler) http.Handler

DefaultMiddlewares satisfies the Auth interfaces

func (Authboss) Flush

func (a Authboss) Flush(rw http.ResponseWriter) error

Flush satisfies the Auth interface

func (Authboss) ProtectMidelewares

func (a Authboss) ProtectMidelewares() []func(http.Handler) http.Handler

ProtectMidelewares satisfies the Auth interfaces

func (Authboss) RedirectIfLoggedIn

func (a Authboss) RedirectIfLoggedIn(h http.Handler) http.Handler

RedirectIfLoggedIn redirects logged in users if visiting the login or register page

func (Authboss) Router

func (a Authboss) Router() http.Handler

Router satisfies the Auth interfaces

type Mailer

type Mailer struct {
	Mailer mailer.Mailer
}

func (Mailer) Send

func (a Mailer) Send(ctx context.Context, abEmail authboss.Email) error

type Renderer

type Renderer struct {
	Base      string
	Templates executor.Executor
}

Renderer sastisfies the authboss.Renderer interface using the executor

func (Renderer) Load

func (r Renderer) Load(names ...string) error

Load the listed templates

func (Renderer) Render

func (r Renderer) Render(ctx context.Context, page string, data authboss.HTMLData) (output []byte, contentType string, err error)

Render a given template

Jump to

Keyboard shortcuts

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