auth

package
v0.0.0-...-6e61812 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionName = "session"
)
View Source
const UserContextKey = contextKey("user")

Variables

This section is empty.

Functions

func GetSessionUser

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

func NewAuthService

func NewAuthService(store sessions.Store)

func NewCookieStore

func NewCookieStore(opts SessionOptions) *sessions.CookieStore

cockie store is not used since it doesn't able to store cookie of larger size

func NewFileSystemStore

func NewFileSystemStore(opts SessionOptions) *sessions.FilesystemStore

func RemoveUserSession

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

func RequireAuth

func RequireAuth(handlerFunc http.HandlerFunc) http.HandlerFunc

func StoreUserSession

func StoreUserSession(w http.ResponseWriter, r *http.Request, u goth.User) error

Types

type SessionOptions

type SessionOptions struct {
	CookiesKey string
	MaxAge     int
	HttpOnly   bool // Should be true in production
	Secure     bool // Should be true in production
}

Jump to

Keyboard shortcuts

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