Documentation
¶
Overview ¶
Package auth implements signing in: checking credentials, starting and ending sessions, and creating the first account.
Index ¶
- type Dependencies
- type Service
- func (s *Service) Authenticate(ctx context.Context, token string) (domain.User, error)
- func (s *Service) BootstrapAdmin(ctx context.Context, email, password string) (bool, error)
- func (s *Service) Login(ctx context.Context, email, password string) (service.AuthSession, error)
- func (s *Service) Logout(ctx context.Context, token string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies struct {
Users resource.UserStore
Sessions resource.SessionStore
Hasher resource.PasswordHasher
Logger *slog.Logger
SessionTTL time.Duration
Now func() time.Time // defaults to time.Now
}
Dependencies are what the auth service needs.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements service.Auth.
func NewService ¶
func NewService(d Dependencies) (*Service, error)
NewService returns an auth service. It hashes a random decoy password once.
func (*Service) Authenticate ¶
Authenticate implements service.Auth.
func (*Service) BootstrapAdmin ¶
BootstrapAdmin implements service.Auth.
Click to show internal directories.
Click to hide internal directories.