Documentation
¶
Index ¶
- type App
- type SessionManager
- func (s *SessionManager) AddSessionMiddleware(next http.Handler) http.Handler
- func (s *SessionManager) Context(ctx context.Context) context.Context
- func (s *SessionManager) IsAuthenticated(r *http.Request) bool
- func (s *SessionManager) RequireAuthenticated(next http.Handler) http.Handler
- func (s *SessionManager) RequireAuthenticatedRedirect(url string) func(http.Handler) http.Handler
- func (s *SessionManager) Session(r *http.Request) *sessions.Session
- type User
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Sessions *SessionManager
// contains filtered or unexported fields
}
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
A SessionManager manages sessions
func NewSessionManager ¶
func NewSessionManager(cfg *conf.Config) *SessionManager
func SessionFromContext ¶
func SessionFromContext(ctx context.Context) *SessionManager
SessionFromContext returns the session manager from the context
func (*SessionManager) AddSessionMiddleware ¶
func (s *SessionManager) AddSessionMiddleware(next http.Handler) http.Handler
Middleware adds this manager to the context, allowing any handler to utilize it
func (*SessionManager) Context ¶
func (s *SessionManager) Context(ctx context.Context) context.Context
Context adds this session manager to ctx
func (*SessionManager) IsAuthenticated ¶
func (s *SessionManager) IsAuthenticated(r *http.Request) bool
func (*SessionManager) RequireAuthenticated ¶
func (s *SessionManager) RequireAuthenticated(next http.Handler) http.Handler
func (*SessionManager) RequireAuthenticatedRedirect ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(conn db.DB) *UserService
func (*UserService) ChangePassword ¶
func (s *UserService) ChangePassword(username, currentPassword, newPassword string) (ok bool, err error)
ChangePassword changes the user's password to newPassword, providing that the current password is correct.
func (*UserService) CreateUser ¶
func (s *UserService) CreateUser(username, password string) error
CreateUser attempts to create a new user with the username and password. If a user with that username already exists, an error is returned.
Click to show internal directories.
Click to hide internal directories.