auth

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUserSession

func AddUserSession(r *http.Request, user *models.User)

func GetAuthenticatedUser

func GetAuthenticatedUser(r *http.Request) (*models.User, error)

func NegotiateContent

func NegotiateContent(accepts []string, offers []string) string

NegotiateContent returns the best content to offer from a set of possible values, based on the preferences represented by the accept values.

func NewSessionManager

func NewSessionManager() *scs.SessionManager

func SigninUser

func SigninUser(r *http.Request, username string, password string) (*models.User, error)

func SignupUser

func SignupUser(ctx context.Context, username string, name string, password string) (*models.User, error)

Types

type AuthenticatedHandler

type AuthenticatedHandler func(http.ResponseWriter, *http.Request, *models.User)

type EnsureAuth

type EnsureAuth struct {
	// contains filtered or unexported fields
}

func NewEnsureAuth

func NewEnsureAuth(handlerToWrap AuthenticatedHandler) *EnsureAuth

func (*EnsureAuth) ServeHTTP

func (ea *EnsureAuth) ServeHTTP(w http.ResponseWriter, r *http.Request)

type InvalidCredentials

type InvalidCredentials struct{}

func (InvalidCredentials) Error

func (e InvalidCredentials) Error() string

type InvalidUsername

type InvalidUsername struct{}

func (InvalidUsername) Error

func (e InvalidUsername) Error() string

type NoCredentialsError

type NoCredentialsError struct{}

func (NoCredentialsError) Error

func (e NoCredentialsError) Error() string

type NoUserError

type NoUserError struct{}

func (NoUserError) Error

func (e NoUserError) Error() string

Jump to

Keyboard shortcuts

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