Documentation
¶
Overview ¶
Package memstore is a reference in-memory implementation of every interface in the store package. It is safe for concurrent use. It exists so authit is usable and testable with zero external dependencies; host applications that need durability implement the same interfaces against their own database.
Index ¶
- type DeviceAuthorizationStore
- func (s *DeviceAuthorizationStore) CreateDeviceAuthorization(_ context.Context, d *store.DeviceAuthorization) error
- func (s *DeviceAuthorizationStore) DeleteDeviceAuthorization(_ context.Context, id string) error
- func (s *DeviceAuthorizationStore) GetDeviceAuthorizationByDeviceCodeHash(_ context.Context, hash string) (*store.DeviceAuthorization, error)
- func (s *DeviceAuthorizationStore) GetDeviceAuthorizationByUserCode(_ context.Context, userCode string) (*store.DeviceAuthorization, error)
- func (s *DeviceAuthorizationStore) UpdateDeviceAuthorization(_ context.Context, d *store.DeviceAuthorization) error
- type EmailVerificationStore
- func (s *EmailVerificationStore) CreateEmailVerificationToken(_ context.Context, t *store.EmailVerificationToken) error
- func (s *EmailVerificationStore) DeleteUserEmailVerificationTokens(_ context.Context, userID string) error
- func (s *EmailVerificationStore) GetEmailVerificationTokenByHash(_ context.Context, hash string) (*store.EmailVerificationToken, error)
- func (s *EmailVerificationStore) MarkEmailVerificationTokenUsed(_ context.Context, id string) error
- type InvitationStore
- func (s *InvitationStore) CreateInvitation(_ context.Context, i *store.Invitation) error
- func (s *InvitationStore) GetInvitation(_ context.Context, id string) (*store.Invitation, error)
- func (s *InvitationStore) GetInvitationByTokenHash(_ context.Context, hash string) (*store.Invitation, error)
- func (s *InvitationStore) ListInvitationsByTeam(_ context.Context, teamID string) ([]*store.Invitation, error)
- func (s *InvitationStore) UpdateInvitation(_ context.Context, i *store.Invitation) error
- type LockoutStore
- func (s *LockoutStore) ClearFailedLoginAttempts(_ context.Context, email string) error
- func (s *LockoutStore) CountRecentFailedLoginAttempts(_ context.Context, email string, since time.Time) (int, error)
- func (s *LockoutStore) IsAccountLocked(_ context.Context, userID string) (bool, error)
- func (s *LockoutStore) LockAccount(_ context.Context, userID string) error
- func (s *LockoutStore) RecordFailedLoginAttempt(_ context.Context, a *store.FailedLoginAttempt) error
- func (s *LockoutStore) UnlockAccount(_ context.Context, userID string) error
- type MemberStore
- func (s *MemberStore) CreateMember(_ context.Context, m *store.Member) error
- func (s *MemberStore) DeleteMember(_ context.Context, id string) error
- func (s *MemberStore) GetMember(_ context.Context, id string) (*store.Member, error)
- func (s *MemberStore) GetMemberByUserAndTeam(_ context.Context, userID, teamID string) (*store.Member, error)
- func (s *MemberStore) ListMembersByTeam(_ context.Context, teamID string) ([]*store.Member, error)
- func (s *MemberStore) ListMembershipsByUser(_ context.Context, userID string) ([]*store.Member, error)
- func (s *MemberStore) UpdateMember(_ context.Context, m *store.Member) error
- type PasswordResetStore
- func (s *PasswordResetStore) CreatePasswordResetToken(_ context.Context, t *store.PasswordResetToken) error
- func (s *PasswordResetStore) DeleteUserPasswordResetTokens(_ context.Context, userID string) error
- func (s *PasswordResetStore) GetPasswordResetTokenByHash(_ context.Context, hash string) (*store.PasswordResetToken, error)
- func (s *PasswordResetStore) MarkPasswordResetTokenUsed(_ context.Context, id string) error
- type PendingTwoFactorStore
- func (s *PendingTwoFactorStore) CreatePendingTwoFactorSession(_ context.Context, sess *store.PendingTwoFactorSession) error
- func (s *PendingTwoFactorStore) DeletePendingTwoFactorSession(_ context.Context, id string) error
- func (s *PendingTwoFactorStore) GetPendingTwoFactorSessionByHash(_ context.Context, hash string) (*store.PendingTwoFactorSession, error)
- type PersonalAccessTokenStore
- func (s *PersonalAccessTokenStore) CreatePersonalAccessToken(_ context.Context, t *store.PersonalAccessToken) error
- func (s *PersonalAccessTokenStore) GetPersonalAccessToken(_ context.Context, id string) (*store.PersonalAccessToken, error)
- func (s *PersonalAccessTokenStore) GetPersonalAccessTokenByHash(_ context.Context, hash string) (*store.PersonalAccessToken, error)
- func (s *PersonalAccessTokenStore) ListPersonalAccessTokensByUser(_ context.Context, userID string) ([]*store.PersonalAccessToken, error)
- func (s *PersonalAccessTokenStore) UpdatePersonalAccessToken(_ context.Context, t *store.PersonalAccessToken) error
- type RefreshTokenStore
- func (s *RefreshTokenStore) CreateRefreshToken(_ context.Context, t *store.RefreshToken) error
- func (s *RefreshTokenStore) GetRefreshTokenByHash(_ context.Context, hash string) (*store.RefreshToken, error)
- func (s *RefreshTokenStore) ListActiveRefreshTokens(_ context.Context, userID string) ([]*store.RefreshToken, error)
- func (s *RefreshTokenStore) RevokeAllUserRefreshTokens(_ context.Context, userID string) error
- func (s *RefreshTokenStore) RevokeRefreshToken(_ context.Context, id string) error
- type SuperuserRefreshTokenStore
- func (s *SuperuserRefreshTokenStore) CreateSuperuserRefreshToken(_ context.Context, t *store.SuperuserRefreshToken) error
- func (s *SuperuserRefreshTokenStore) GetSuperuserRefreshTokenByHash(_ context.Context, hash string) (*store.SuperuserRefreshToken, error)
- func (s *SuperuserRefreshTokenStore) RevokeAllSuperuserRefreshTokens(_ context.Context, superuserID string) error
- func (s *SuperuserRefreshTokenStore) RevokeSuperuserRefreshToken(_ context.Context, id string) error
- type SuperuserStore
- func (s *SuperuserStore) CountSuperusers(_ context.Context) (int, error)
- func (s *SuperuserStore) CreateSuperuser(_ context.Context, su *store.Superuser) error
- func (s *SuperuserStore) GetSuperuserByEmail(_ context.Context, email string) (*store.Superuser, error)
- func (s *SuperuserStore) GetSuperuserByID(_ context.Context, id string) (*store.Superuser, error)
- func (s *SuperuserStore) ListSuperusers(_ context.Context) ([]*store.Superuser, error)
- func (s *SuperuserStore) UpdateSuperuser(_ context.Context, su *store.Superuser) error
- type TOTPStore
- func (s *TOTPStore) CreateTOTPSettings(_ context.Context, t *store.TOTPSettings) error
- func (s *TOTPStore) DeleteTOTPSettings(_ context.Context, userID string) error
- func (s *TOTPStore) GetTOTPSettingsByUserID(_ context.Context, userID string) (*store.TOTPSettings, error)
- func (s *TOTPStore) UpdateTOTPSettings(_ context.Context, t *store.TOTPSettings) error
- type TeamStore
- func (s *TeamStore) CreateTeam(_ context.Context, t *store.Team) error
- func (s *TeamStore) DeleteTeam(_ context.Context, id string) error
- func (s *TeamStore) GetTeam(_ context.Context, id string) (*store.Team, error)
- func (s *TeamStore) GetTeamBySlug(_ context.Context, slug string) (*store.Team, error)
- func (s *TeamStore) UpdateTeam(_ context.Context, t *store.Team) error
- type UserStore
- func (s *UserStore) CreateUser(_ context.Context, u *store.User) error
- func (s *UserStore) GetUserByEmail(_ context.Context, email string) (*store.User, error)
- func (s *UserStore) GetUserByID(_ context.Context, id string) (*store.User, error)
- func (s *UserStore) UpdateUser(_ context.Context, u *store.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceAuthorizationStore ¶
type DeviceAuthorizationStore struct {
// contains filtered or unexported fields
}
DeviceAuthorizationStore is an in-memory store.DeviceAuthorizationStore.
func NewDeviceAuthorizationStore ¶
func NewDeviceAuthorizationStore() *DeviceAuthorizationStore
func (*DeviceAuthorizationStore) CreateDeviceAuthorization ¶
func (s *DeviceAuthorizationStore) CreateDeviceAuthorization(_ context.Context, d *store.DeviceAuthorization) error
func (*DeviceAuthorizationStore) DeleteDeviceAuthorization ¶
func (s *DeviceAuthorizationStore) DeleteDeviceAuthorization(_ context.Context, id string) error
func (*DeviceAuthorizationStore) GetDeviceAuthorizationByDeviceCodeHash ¶
func (s *DeviceAuthorizationStore) GetDeviceAuthorizationByDeviceCodeHash(_ context.Context, hash string) (*store.DeviceAuthorization, error)
func (*DeviceAuthorizationStore) GetDeviceAuthorizationByUserCode ¶
func (s *DeviceAuthorizationStore) GetDeviceAuthorizationByUserCode(_ context.Context, userCode string) (*store.DeviceAuthorization, error)
func (*DeviceAuthorizationStore) UpdateDeviceAuthorization ¶
func (s *DeviceAuthorizationStore) UpdateDeviceAuthorization(_ context.Context, d *store.DeviceAuthorization) error
type EmailVerificationStore ¶
type EmailVerificationStore struct {
// contains filtered or unexported fields
}
EmailVerificationStore is an in-memory store.EmailVerificationStore.
func NewEmailVerificationStore ¶
func NewEmailVerificationStore() *EmailVerificationStore
func (*EmailVerificationStore) CreateEmailVerificationToken ¶
func (s *EmailVerificationStore) CreateEmailVerificationToken(_ context.Context, t *store.EmailVerificationToken) error
func (*EmailVerificationStore) DeleteUserEmailVerificationTokens ¶
func (s *EmailVerificationStore) DeleteUserEmailVerificationTokens(_ context.Context, userID string) error
func (*EmailVerificationStore) GetEmailVerificationTokenByHash ¶
func (s *EmailVerificationStore) GetEmailVerificationTokenByHash(_ context.Context, hash string) (*store.EmailVerificationToken, error)
func (*EmailVerificationStore) MarkEmailVerificationTokenUsed ¶
func (s *EmailVerificationStore) MarkEmailVerificationTokenUsed(_ context.Context, id string) error
type InvitationStore ¶
type InvitationStore struct {
// contains filtered or unexported fields
}
InvitationStore is an in-memory store.InvitationStore.
func NewInvitationStore ¶
func NewInvitationStore() *InvitationStore
func (*InvitationStore) CreateInvitation ¶
func (s *InvitationStore) CreateInvitation(_ context.Context, i *store.Invitation) error
func (*InvitationStore) GetInvitation ¶
func (s *InvitationStore) GetInvitation(_ context.Context, id string) (*store.Invitation, error)
func (*InvitationStore) GetInvitationByTokenHash ¶
func (s *InvitationStore) GetInvitationByTokenHash(_ context.Context, hash string) (*store.Invitation, error)
func (*InvitationStore) ListInvitationsByTeam ¶
func (s *InvitationStore) ListInvitationsByTeam(_ context.Context, teamID string) ([]*store.Invitation, error)
func (*InvitationStore) UpdateInvitation ¶
func (s *InvitationStore) UpdateInvitation(_ context.Context, i *store.Invitation) error
type LockoutStore ¶
type LockoutStore struct {
// contains filtered or unexported fields
}
LockoutStore is an in-memory store.LockoutStore, shared by the user and superuser planes (they key lockouts by their own IDs/emails, which never collide across planes in practice since a host application uses separate instances per plane).
func NewLockoutStore ¶
func NewLockoutStore() *LockoutStore
func (*LockoutStore) ClearFailedLoginAttempts ¶
func (s *LockoutStore) ClearFailedLoginAttempts(_ context.Context, email string) error
func (*LockoutStore) CountRecentFailedLoginAttempts ¶
func (*LockoutStore) IsAccountLocked ¶
func (*LockoutStore) LockAccount ¶
func (s *LockoutStore) LockAccount(_ context.Context, userID string) error
func (*LockoutStore) RecordFailedLoginAttempt ¶
func (s *LockoutStore) RecordFailedLoginAttempt(_ context.Context, a *store.FailedLoginAttempt) error
func (*LockoutStore) UnlockAccount ¶
func (s *LockoutStore) UnlockAccount(_ context.Context, userID string) error
type MemberStore ¶
type MemberStore struct {
// contains filtered or unexported fields
}
MemberStore is an in-memory store.MemberStore.
func NewMemberStore ¶
func NewMemberStore() *MemberStore
func (*MemberStore) CreateMember ¶
func (*MemberStore) DeleteMember ¶
func (s *MemberStore) DeleteMember(_ context.Context, id string) error
func (*MemberStore) GetMemberByUserAndTeam ¶
func (*MemberStore) ListMembersByTeam ¶
func (*MemberStore) ListMembershipsByUser ¶
func (*MemberStore) UpdateMember ¶
type PasswordResetStore ¶
type PasswordResetStore struct {
// contains filtered or unexported fields
}
PasswordResetStore is an in-memory store.PasswordResetStore.
func NewPasswordResetStore ¶
func NewPasswordResetStore() *PasswordResetStore
func (*PasswordResetStore) CreatePasswordResetToken ¶
func (s *PasswordResetStore) CreatePasswordResetToken(_ context.Context, t *store.PasswordResetToken) error
func (*PasswordResetStore) DeleteUserPasswordResetTokens ¶
func (s *PasswordResetStore) DeleteUserPasswordResetTokens(_ context.Context, userID string) error
func (*PasswordResetStore) GetPasswordResetTokenByHash ¶
func (s *PasswordResetStore) GetPasswordResetTokenByHash(_ context.Context, hash string) (*store.PasswordResetToken, error)
func (*PasswordResetStore) MarkPasswordResetTokenUsed ¶
func (s *PasswordResetStore) MarkPasswordResetTokenUsed(_ context.Context, id string) error
type PendingTwoFactorStore ¶
type PendingTwoFactorStore struct {
// contains filtered or unexported fields
}
PendingTwoFactorStore is an in-memory store.PendingTwoFactorStore.
func NewPendingTwoFactorStore ¶
func NewPendingTwoFactorStore() *PendingTwoFactorStore
func (*PendingTwoFactorStore) CreatePendingTwoFactorSession ¶
func (s *PendingTwoFactorStore) CreatePendingTwoFactorSession(_ context.Context, sess *store.PendingTwoFactorSession) error
func (*PendingTwoFactorStore) DeletePendingTwoFactorSession ¶
func (s *PendingTwoFactorStore) DeletePendingTwoFactorSession(_ context.Context, id string) error
func (*PendingTwoFactorStore) GetPendingTwoFactorSessionByHash ¶
func (s *PendingTwoFactorStore) GetPendingTwoFactorSessionByHash(_ context.Context, hash string) (*store.PendingTwoFactorSession, error)
type PersonalAccessTokenStore ¶
type PersonalAccessTokenStore struct {
// contains filtered or unexported fields
}
PersonalAccessTokenStore is an in-memory store.PersonalAccessTokenStore.
func NewPersonalAccessTokenStore ¶
func NewPersonalAccessTokenStore() *PersonalAccessTokenStore
func (*PersonalAccessTokenStore) CreatePersonalAccessToken ¶
func (s *PersonalAccessTokenStore) CreatePersonalAccessToken(_ context.Context, t *store.PersonalAccessToken) error
func (*PersonalAccessTokenStore) GetPersonalAccessToken ¶
func (s *PersonalAccessTokenStore) GetPersonalAccessToken(_ context.Context, id string) (*store.PersonalAccessToken, error)
func (*PersonalAccessTokenStore) GetPersonalAccessTokenByHash ¶
func (s *PersonalAccessTokenStore) GetPersonalAccessTokenByHash(_ context.Context, hash string) (*store.PersonalAccessToken, error)
func (*PersonalAccessTokenStore) ListPersonalAccessTokensByUser ¶
func (s *PersonalAccessTokenStore) ListPersonalAccessTokensByUser(_ context.Context, userID string) ([]*store.PersonalAccessToken, error)
func (*PersonalAccessTokenStore) UpdatePersonalAccessToken ¶
func (s *PersonalAccessTokenStore) UpdatePersonalAccessToken(_ context.Context, t *store.PersonalAccessToken) error
type RefreshTokenStore ¶
type RefreshTokenStore struct {
// contains filtered or unexported fields
}
RefreshTokenStore is an in-memory store.RefreshTokenStore.
func NewRefreshTokenStore ¶
func NewRefreshTokenStore() *RefreshTokenStore
func (*RefreshTokenStore) CreateRefreshToken ¶
func (s *RefreshTokenStore) CreateRefreshToken(_ context.Context, t *store.RefreshToken) error
func (*RefreshTokenStore) GetRefreshTokenByHash ¶
func (s *RefreshTokenStore) GetRefreshTokenByHash(_ context.Context, hash string) (*store.RefreshToken, error)
func (*RefreshTokenStore) ListActiveRefreshTokens ¶
func (s *RefreshTokenStore) ListActiveRefreshTokens(_ context.Context, userID string) ([]*store.RefreshToken, error)
func (*RefreshTokenStore) RevokeAllUserRefreshTokens ¶
func (s *RefreshTokenStore) RevokeAllUserRefreshTokens(_ context.Context, userID string) error
func (*RefreshTokenStore) RevokeRefreshToken ¶
func (s *RefreshTokenStore) RevokeRefreshToken(_ context.Context, id string) error
type SuperuserRefreshTokenStore ¶
type SuperuserRefreshTokenStore struct {
// contains filtered or unexported fields
}
SuperuserRefreshTokenStore is an in-memory store.SuperuserRefreshTokenStore.
func NewSuperuserRefreshTokenStore ¶
func NewSuperuserRefreshTokenStore() *SuperuserRefreshTokenStore
func (*SuperuserRefreshTokenStore) CreateSuperuserRefreshToken ¶
func (s *SuperuserRefreshTokenStore) CreateSuperuserRefreshToken(_ context.Context, t *store.SuperuserRefreshToken) error
func (*SuperuserRefreshTokenStore) GetSuperuserRefreshTokenByHash ¶
func (s *SuperuserRefreshTokenStore) GetSuperuserRefreshTokenByHash(_ context.Context, hash string) (*store.SuperuserRefreshToken, error)
func (*SuperuserRefreshTokenStore) RevokeAllSuperuserRefreshTokens ¶
func (s *SuperuserRefreshTokenStore) RevokeAllSuperuserRefreshTokens(_ context.Context, superuserID string) error
func (*SuperuserRefreshTokenStore) RevokeSuperuserRefreshToken ¶
func (s *SuperuserRefreshTokenStore) RevokeSuperuserRefreshToken(_ context.Context, id string) error
type SuperuserStore ¶
type SuperuserStore struct {
// contains filtered or unexported fields
}
SuperuserStore is an in-memory store.SuperuserStore.
func NewSuperuserStore ¶
func NewSuperuserStore() *SuperuserStore
func (*SuperuserStore) CountSuperusers ¶
func (s *SuperuserStore) CountSuperusers(_ context.Context) (int, error)
func (*SuperuserStore) CreateSuperuser ¶
func (*SuperuserStore) GetSuperuserByEmail ¶
func (*SuperuserStore) GetSuperuserByID ¶
func (*SuperuserStore) ListSuperusers ¶
func (*SuperuserStore) UpdateSuperuser ¶
type TOTPStore ¶
type TOTPStore struct {
// contains filtered or unexported fields
}
TOTPStore is an in-memory store.TOTPStore.
func NewTOTPStore ¶
func NewTOTPStore() *TOTPStore
func (*TOTPStore) CreateTOTPSettings ¶
func (*TOTPStore) DeleteTOTPSettings ¶
func (*TOTPStore) GetTOTPSettingsByUserID ¶
func (*TOTPStore) UpdateTOTPSettings ¶
type TeamStore ¶
type TeamStore struct {
// contains filtered or unexported fields
}
TeamStore is an in-memory store.TeamStore.
func NewTeamStore ¶
func NewTeamStore() *TeamStore
func (*TeamStore) CreateTeam ¶
func (*TeamStore) GetTeamBySlug ¶
type UserStore ¶
type UserStore struct {
// contains filtered or unexported fields
}
UserStore is an in-memory store.UserStore.