Documentation
¶
Index ¶
- Constants
- Variables
- func HashPassword(password string) (string, error)
- func IsPasswordHash(value string) bool
- func VerifyPasswordHash(stored string, password string) (bool, error)
- type Config
- type LegacyPasswordStore
- type Service
- func (s *Service) Authenticate(ctx context.Context, username string, password string) (*models.User, error)
- func (s *Service) CookieName() string
- func (s *Service) Login(ctx context.Context, username string, password string) (string, Session, error)
- func (s *Service) Logout(token string)
- func (s *Service) RevokeUserSessions(userID string)
- func (s *Service) Session(token string) (Session, bool)
- type Session
- type SessionStore
- type UserStore
Constants ¶
View Source
const ( DefaultCookieName = "emerald_session" DefaultSessionTTL = 24 * time.Hour )
Variables ¶
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
View Source
var ErrRateLimited = errors.New("too many login attempts")
Functions ¶
func HashPassword ¶ added in v1.11.1
func IsPasswordHash ¶ added in v1.11.1
Types ¶
type Config ¶
type Config struct {
SessionTTL time.Duration
CookieName string
SessionStore SessionStore
}
type LegacyPasswordStore ¶ added in v1.11.1
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) Authenticate ¶
func (*Service) CookieName ¶
func (*Service) RevokeUserSessions ¶
type SessionStore ¶ added in v1.11.1
Click to show internal directories.
Click to hide internal directories.