Documentation
¶
Index ¶
- Variables
- func CheckPassword(password, hash string) error
- func ClearUserSession(c buffalo.Context)
- func GetUserSession(c buffalo.Context) string
- func HashPassword(password string) (string, error)
- func LoginFormHandler(c buffalo.Context) error
- func LoginHandler(c buffalo.Context) error
- func LogoutHandler(c buffalo.Context) error
- func RegisterAuthJobs(mux interface{}, store interface{})
- func RequireLogin(next buffalo.Handler) buffalo.Handler
- func SetUserSession(c buffalo.Context, userID string)
- func UseStore(store UserStore)
- type ExtendedUserStore
- type MemoryStore
- func (m *MemoryStore) ByEmail(ctx context.Context, email string) (*User, error)
- func (m *MemoryStore) ByID(ctx context.Context, id string) (*User, error)
- func (m *MemoryStore) CleanupSessions(ctx context.Context, maxAge, maxInactivity time.Duration) (int, error)
- func (m *MemoryStore) Create(ctx context.Context, user *User) error
- func (m *MemoryStore) ExistsEmail(ctx context.Context, email string) (bool, error)
- func (m *MemoryStore) IncrementFailedLoginAttempts(ctx context.Context, email string) error
- func (m *MemoryStore) ResetFailedLoginAttempts(ctx context.Context, email string) error
- func (m *MemoryStore) UpdatePassword(ctx context.Context, id string, passwordDigest string) error
- type User
- type UserStore
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckPassword ¶
func ClearUserSession ¶
func GetUserSession ¶
func HashPassword ¶
Password helpers - needed for "logged in as valid user" step
func LoginFormHandler ¶
LoginFormHandler serves the login form - ONLY what the feature asks for
func LoginHandler ¶
LoginHandler processes login - ONLY what the feature asks for
func LogoutHandler ¶
LogoutHandler processes logout - ONLY what the feature asks for
func RegisterAuthJobs ¶
func RegisterAuthJobs(mux interface{}, store interface{})
RegisterAuthJobs is a stub to satisfy compilation - NOT IMPLEMENTED per BDD The feature file doesn't specify background jobs
func RequireLogin ¶
RequireLogin middleware - feature asks for this specifically
func SetUserSession ¶
Session helpers - minimal implementation for what tests need
Types ¶
type ExtendedUserStore ¶
type ExtendedUserStore interface {
UserStore
// Minimal stub methods to satisfy compilation
ByID(ctx context.Context, id string) (*User, error)
IncrementFailedLoginAttempts(ctx context.Context, email string) error
ResetFailedLoginAttempts(ctx context.Context, email string) error
CleanupSessions(ctx context.Context, maxAge, maxInactivity time.Duration) (int, error)
}
ExtendedUserStore is a stub interface to satisfy jobs package compilation This is NOT part of the BDD feature requirements and should be removed once jobs package is properly tested with BDD-first approach
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
Simple in-memory store for testing - ONLY what's needed
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) CleanupSessions ¶
func (*MemoryStore) ExistsEmail ¶
func (*MemoryStore) IncrementFailedLoginAttempts ¶
func (m *MemoryStore) IncrementFailedLoginAttempts(ctx context.Context, email string) error
Make MemoryStore implement ExtendedUserStore minimally
func (*MemoryStore) ResetFailedLoginAttempts ¶
func (m *MemoryStore) ResetFailedLoginAttempts(ctx context.Context, email string) error
func (*MemoryStore) UpdatePassword ¶
type User ¶
type User struct {
ID string `json:"id" db:"id"`
Email string `json:"email" db:"email"`
DisplayName string `json:"name" db:"name"`
PasswordDigest string `json:"-" db:"password_digest"`
IsActive bool `json:"is_active" db:"is_active"`
}
User represents a minimal user for authentication
func CurrentUser ¶
CurrentUser gets the current user from context - feature asks for this
type UserStore ¶
type UserStore interface {
Create(ctx context.Context, user *User) error
ByEmail(ctx context.Context, email string) (*User, error)
ByID(ctx context.Context, id string) (*User, error)
UpdatePassword(ctx context.Context, id string, passwordDigest string) error
ExistsEmail(ctx context.Context, email string) (bool, error)
}
UserStore defines the minimal interface for user storage
func NewSQLStore ¶
NewSQLStore is a stub to satisfy compilation - NOT IMPLEMENTED per BDD The feature file doesn't specify SQL storage, so this returns memory store