auth

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionName = "session"
)

Variables

This section is empty.

Functions

func NewFileStore added in v0.7.3

func NewFileStore(opts SessionOptions) (*sessions.FilesystemStore, error)

func RequireAuth

func RequireAuth(auth *AuthService) func(next http.Handler) http.Handler

Types

type AuthService

type AuthService struct{}

func NewAuthService

func NewAuthService(store sessions.Store) *AuthService

func (*AuthService) GetSessionUser

func (a *AuthService) GetSessionUser(r *http.Request) (goth.User, error)

func (*AuthService) RemoveUserSession

func (a *AuthService) RemoveUserSession(w http.ResponseWriter, r *http.Request)

func (*AuthService) StoreUserSession

func (a *AuthService) StoreUserSession(
	w http.ResponseWriter,
	r *http.Request,
	user goth.User,
) error

type SessionOptions

type SessionOptions struct {
	StorePath  string
	CookiesKey string
	MaxAge     int
	HttpOnly   bool // Should be true if the site is served over HTTP (development environment)
	Secure     bool // Should be true if the site is served over HTTPS (production environment)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳