Documentation
¶
Index ¶
- Variables
- func EnsureUsername(username, email string) (string, error)
- func Hash(password string) (string, error)
- func SanitizeUsername(s string) string
- func SecureFiveDigits() (int64, error)
- func ValidateUsername(username string) error
- func Verify(password, encoded string) (bool, error)
- type Config
- type LoginInput
- type OAuthIdentityInput
- type Service
- func (s *Service) AddPassword(ctx context.Context, userID uuid.UUID, passwordHash string) error
- func (s *Service) ChangePassword(ctx context.Context, userID uuid.UUID, currentPassword string, ...) error
- func (s *Service) ChangeUsername(ctx context.Context, userID uuid.UUID, username string) error
- func (s *Service) CompleteAccountRecoveryProviderLinkWithPassword(ctx context.Context, linkID uuid.UUID, password string, now time.Time) (domain.User, error)
- func (s *Service) CompleteAccountRecoveryProviderLinkWithProviderProof(ctx context.Context, linkID uuid.UUID, proofProvider domain.Provider, ...) (domain.User, error)
- func (s *Service) CompleteProviderLink(ctx context.Context, linkID uuid.UUID, userID uuid.UUID, sessionID uuid.UUID, ...) error
- func (s *Service) DeleteUser(ctx context.Context, userID uuid.UUID) error
- func (s *Service) DisableUser(ctx context.Context, userID uuid.UUID) error
- func (s *Service) GetPendingProviderLink(ctx context.Context, linkID uuid.UUID) (domain.PendingProviderLink, error)
- func (s *Service) GetUser(ctx context.Context, userID uuid.UUID) (domain.User, error)
- func (s *Service) GetUserByEmail(ctx context.Context, email string) (domain.User, error)
- func (s *Service) IsProviderEnabled(provider domain.Provider) bool
- func (s *Service) ListUserAuthProviders(ctx context.Context, userID uuid.UUID) ([]domain.AuthProvider, error)
- func (s *Service) Login(ctx context.Context, in LoginInput) (domain.User, error)
- func (s *Service) Signup(ctx context.Context, in SignupInput) (domain.User, error)
- func (s *Service) StartAccountRecoveryProviderLink(ctx context.Context, in OAuthIdentityInput, now time.Time) (domain.PendingProviderLink, error)
- func (s *Service) StartProviderLink(ctx context.Context, userID uuid.UUID, sessionID uuid.UUID, ...) (uuid.UUID, error)
- func (s *Service) UnlinkAuthProvider(ctx context.Context, userID uuid.UUID, provider domain.Provider) error
- func (s *Service) UserExistsByEmail(ctx context.Context, email string) (bool, error)
- type SignupInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidCredentials = errors.New("invalid credentials") ErrUserAlreadyExists = errors.New("user already exists") ErrUnsupportedProvider = errors.New("auth provider is not supported") ErrAccountExistsMustLink = errors.New("account exists; must link provider explicitly") ErrUsernameTaken = errors.New("username already taken") ErrInvalidUsername = errors.New("invalid username") ErrNoRolesInContext = errors.New("no roles in context for user") ErrEmailNotAllowed = errors.New("email is not allowed to access the application") ErrAuthProviderAlreadyLinked = errors.New("auth provider already linked to another user") ErrAuthProviderAlreadyLinkedToUser = errors.New("auth provider already linked to user") ErrCannotRemoveLastAuthMethod = errors.New("cannot remove last auth method") ErrCannotRemoveLastAuthProvider = ErrCannotRemoveLastAuthMethod ErrCannotDeleteLastAdmin = errors.New("cannot delete last active admin") ErrPasswordAlreadyExists = errors.New("password provider already exists") ErrPendingProviderLinkExpired = errors.New("pending provider link expired") ErrPendingProviderLinkInvalid = errors.New("pending provider link invalid") ErrPendingProviderLinkNeedsProof = errors.New("pending provider link requires proof") ErrProviderEmailNotVerified = errors.New("provider email is not verified") ErrProviderDisabled = errors.New("provider disabled") ErrPasswordProviderMissing = errors.New("password provider missing") ErrPasskeyNotFound = errors.New("passkey not found") ErrPasskeyAlreadyExists = errors.New("passkey already exists") ErrPasskeyRegistrationInvalid = errors.New("passkey registration invalid") ErrPasskeyAuthenticationInvalid = errors.New("passkey authentication invalid") )
Functions ¶
func EnsureUsername ¶ added in v0.1.13
func SanitizeUsername ¶
sanitizeUsername: - keeps only [a-zA-z0-9_-] - turns runs of other chars into a single '-' - trims leading/trailing '-' and '_'
func SecureFiveDigits ¶
func ValidateUsername ¶
Types ¶
type Config ¶
type Config struct {
Store *store.Store
Tx *tx.Manager
WebhookPublisher webhook.Publisher
Logger *slog.Logger
AccessPolicy accesspolicy.EmailAccessPolicy
OAuthProviders oauth.OAuthProviders
}
type LoginInput ¶
type OAuthIdentityInput ¶ added in v0.1.19
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AddPassword ¶ added in v0.1.17
func (*Service) ChangePassword ¶ added in v0.1.17
func (*Service) ChangeUsername ¶
func (*Service) CompleteAccountRecoveryProviderLinkWithPassword ¶ added in v0.1.19
func (*Service) CompleteAccountRecoveryProviderLinkWithProviderProof ¶ added in v0.1.19
func (*Service) CompleteProviderLink ¶ added in v0.1.17
func (*Service) DeleteUser ¶
func (*Service) DisableUser ¶
func (*Service) GetPendingProviderLink ¶ added in v0.1.19
func (*Service) GetUserByEmail ¶ added in v0.1.14
func (*Service) IsProviderEnabled ¶ added in v0.1.17
func (*Service) ListUserAuthProviders ¶ added in v0.1.17
func (*Service) StartAccountRecoveryProviderLink ¶ added in v0.1.19
func (s *Service) StartAccountRecoveryProviderLink( ctx context.Context, in OAuthIdentityInput, now time.Time, ) (domain.PendingProviderLink, error)
func (*Service) StartProviderLink ¶ added in v0.1.17
func (*Service) UnlinkAuthProvider ¶ added in v0.1.17
Click to show internal directories.
Click to hide internal directories.