Documentation
¶
Index ¶
- Constants
- Variables
- type Lockout
- type LockoutProvider
- type OOBOTPAuthenticatorProvider
- type OTPCodeService
- type PasskeyAuthenticatorProvider
- type PasswordAuthenticatorProvider
- type RateLimiter
- type RateLimits
- type Reservation
- type Service
- func (s *Service) ClearLockoutAttempts(ctx context.Context, userID string, ...) error
- func (s *Service) Count(ctx context.Context, userID string) (uint64, error)
- func (s *Service) Create(ctx context.Context, info *authenticator.Info) error
- func (s *Service) Delete(ctx context.Context, info *authenticator.Info) error
- func (s *Service) Get(ctx context.Context, id string) (*authenticator.Info, error)
- func (s *Service) GetMany(ctx context.Context, ids []string) ([]*authenticator.Info, error)
- func (s *Service) List(ctx context.Context, userID string, filters ...authenticator.Filter) ([]*authenticator.Info, error)
- func (s *Service) ListByUserIDs(ctx context.Context, userIDs []string, filters ...authenticator.Filter) (map[string][]*authenticator.Info, error)
- func (s *Service) ListRefsByUsers(ctx context.Context, userIDs []string, ...) ([]*authenticator.Ref, error)
- func (s *Service) New(ctx context.Context, spec *authenticator.Spec) (*authenticator.Info, error)
- func (s *Service) NewWithAuthenticatorID(ctx context.Context, authenticatorID string, spec *authenticator.Spec) (*authenticator.Info, error)
- func (s *Service) RemoveOrphans(ctx context.Context, identities []*identity.Info) error
- func (s *Service) Update(ctx context.Context, info *authenticator.Info) error
- func (s *Service) UpdateOOBOTPTarget(ai *authenticator.Info, option UpdateOOBOTPTargetOption) (*authenticator.Info, bool)
- func (s *Service) UpdateOrphans(ctx context.Context, oldInfo *identity.Info, newInfo *identity.Info) error
- func (s *Service) UpdatePassword(ctx context.Context, ai *authenticator.Info, options *UpdatePasswordOptions) (bool, *authenticator.Info, error)
- func (s *Service) VerifyOneWithSpec(ctx context.Context, userID string, authenticatorType model.AuthenticatorType, ...) (info *authenticator.Info, verifyResult *VerifyResult, err error)
- type Store
- func (s *Store) Count(ctx context.Context, userID string) (uint64, error)
- func (s *Store) GetRefByID(ctx context.Context, id string) (*authenticator.Ref, error)
- func (s *Store) ListRefsByIDs(ctx context.Context, ids []string) ([]*authenticator.Ref, error)
- func (s *Store) ListRefsByUsers(ctx context.Context, userIDs []string, ...) ([]*authenticator.Ref, error)
- type TOTPAuthenticatorProvider
- type UpdateOOBOTPTargetOption
- type UpdatePasswordOptions
- type VerifyOptions
- type VerifyResult
Constants ¶
View Source
const ( VerifyPasswordPerIP ratelimit.BucketName = "VerifyPasswordPerIP" VerifyPasswordPerUserPerIP ratelimit.BucketName = "VerifyPasswordPerUserPerIP" VerifyTOTPPerIP ratelimit.BucketName = "VerifyTOTPPerIP" VerifyTOTPPerUserPerIP ratelimit.BucketName = "VerifyTOTPPerUserPerIP" VerifyPasskeyPerIP ratelimit.BucketName = "VerifyPasskeyPerIP" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Lockout ¶
type Lockout struct { Config *config.AuthenticationLockoutConfig RemoteIP httputil.RemoteIP Provider LockoutProvider }
func (*Lockout) ClearAttempts ¶
func (*Lockout) MakeAttempt ¶
type LockoutProvider ¶
type LockoutProvider interface { MakeAttempts(ctx context.Context, spec lockout.LockoutSpec, contributor string, attempts int) (result *lockout.MakeAttemptResult, err error) ClearAttempts(ctx context.Context, spec lockout.LockoutSpec, contributor string) error }
type OOBOTPAuthenticatorProvider ¶
type OOBOTPAuthenticatorProvider interface { New(ctx context.Context, id string, userID string, oobAuthenticatorType model.AuthenticatorType, target string, isDefault bool, kind string) (*authenticator.OOBOTP, error) UpdateTarget(a *authenticator.OOBOTP, option oob.UpdateTargetOption) (*authenticator.OOBOTP, bool) Get(ctx context.Context, userID, id string) (*authenticator.OOBOTP, error) GetMany(ctx context.Context, ids []string) ([]*authenticator.OOBOTP, error) List(ctx context.Context, userID string) ([]*authenticator.OOBOTP, error) Create(ctx context.Context, a *authenticator.OOBOTP) error Update(ctx context.Context, a *authenticator.OOBOTP) error Delete(ctx context.Context, a *authenticator.OOBOTP) error }
type OTPCodeService ¶
type PasskeyAuthenticatorProvider ¶
type PasskeyAuthenticatorProvider interface { New( ctx context.Context, id string, userID string, attestationResponse []byte, isDefault bool, kind string, ) (*authenticator.Passkey, error) Get(ctx context.Context, userID, id string) (*authenticator.Passkey, error) GetMany(ctx context.Context, ids []string) ([]*authenticator.Passkey, error) List(ctx context.Context, userID string) ([]*authenticator.Passkey, error) Create(ctx context.Context, a *authenticator.Passkey) error Update(ctx context.Context, a *authenticator.Passkey) error Delete(ctx context.Context, a *authenticator.Passkey) error Authenticate(ctx context.Context, a *authenticator.Passkey, assertionResponse []byte) (requireUpdate bool, err error) }
type PasswordAuthenticatorProvider ¶
type PasswordAuthenticatorProvider interface { New(ctx context.Context, id string, userID string, passwordSpec *authenticator.PasswordSpec, isDefault bool, kind string) (*authenticator.Password, error) UpdatePassword(ctx context.Context, a *authenticator.Password, options *password.UpdatePasswordOptions) (bool, *authenticator.Password, error) Get(ctx context.Context, userID, id string) (*authenticator.Password, error) GetMany(ctx context.Context, ids []string) ([]*authenticator.Password, error) List(ctx context.Context, userID string) ([]*authenticator.Password, error) Create(ctx context.Context, a *authenticator.Password) error Update(ctx context.Context, a *authenticator.Password) error Delete(ctx context.Context, a *authenticator.Password) error Authenticate(ctx context.Context, a *authenticator.Password, password string) (verifyResult *password.VerifyResult, err error) }
type RateLimiter ¶
type RateLimiter interface { Reserve(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.Reservation, *ratelimit.FailedReservation, error) Cancel(ctx context.Context, r *ratelimit.Reservation) }
type RateLimits ¶
type RateLimits struct { IP httputil.RemoteIP Config *config.AuthenticationConfig RateLimiter RateLimiter }
func (*RateLimits) Cancel ¶
func (l *RateLimits) Cancel(ctx context.Context, r *Reservation)
func (*RateLimits) Reserve ¶
func (l *RateLimits) Reserve(ctx context.Context, userID string, authType model.AuthenticatorType) (*Reservation, error)
type Reservation ¶
type Reservation struct {
// contains filtered or unexported fields
}
func (*Reservation) PreventCancel ¶
func (r *Reservation) PreventCancel()
type Service ¶
type Service struct { Store *Store Config *config.AppConfig Password PasswordAuthenticatorProvider Passkey PasskeyAuthenticatorProvider TOTP TOTPAuthenticatorProvider OOBOTP OOBOTPAuthenticatorProvider OTPCodeService OTPCodeService RateLimits RateLimits Lockout Lockout }
func (*Service) ClearLockoutAttempts ¶
func (*Service) List ¶
func (s *Service) List(ctx context.Context, userID string, filters ...authenticator.Filter) ([]*authenticator.Info, error)
func (*Service) ListByUserIDs ¶
func (s *Service) ListByUserIDs(ctx context.Context, userIDs []string, filters ...authenticator.Filter) (map[string][]*authenticator.Info, error)
nolint:gocognit
func (*Service) ListRefsByUsers ¶
func (s *Service) ListRefsByUsers(ctx context.Context, userIDs []string, authenticatorType *model.AuthenticatorType, authenticatorKind *authenticator.Kind) ([]*authenticator.Ref, error)
func (*Service) New ¶
func (s *Service) New(ctx context.Context, spec *authenticator.Spec) (*authenticator.Info, error)
func (*Service) NewWithAuthenticatorID ¶
func (s *Service) NewWithAuthenticatorID(ctx context.Context, authenticatorID string, spec *authenticator.Spec) (*authenticator.Info, error)
func (*Service) RemoveOrphans ¶
func (*Service) UpdateOOBOTPTarget ¶
func (s *Service) UpdateOOBOTPTarget(ai *authenticator.Info, option UpdateOOBOTPTargetOption) (*authenticator.Info, bool)
func (*Service) UpdateOrphans ¶
func (*Service) UpdatePassword ¶
func (s *Service) UpdatePassword(ctx context.Context, ai *authenticator.Info, options *UpdatePasswordOptions) (bool, *authenticator.Info, error)
func (*Service) VerifyOneWithSpec ¶
func (s *Service) VerifyOneWithSpec( ctx context.Context, userID string, authenticatorType model.AuthenticatorType, infos []*authenticator.Info, spec *authenticator.Spec, options *VerifyOptions) (info *authenticator.Info, verifyResult *VerifyResult, err error)
Given a list of authenticators, try to verify one of them
type Store ¶
type Store struct { SQLBuilder *appdb.SQLBuilderApp SQLExecutor *appdb.SQLExecutor }
func (*Store) GetRefByID ¶
func (*Store) ListRefsByIDs ¶
func (*Store) ListRefsByUsers ¶
func (s *Store) ListRefsByUsers(ctx context.Context, userIDs []string, authenticatorType *model.AuthenticatorType, authenticatorKind *authenticator.Kind) ([]*authenticator.Ref, error)
type TOTPAuthenticatorProvider ¶
type TOTPAuthenticatorProvider interface { New(id string, userID string, totpSpec *authenticator.TOTPSpec, isDefault bool, kind string) (*authenticator.TOTP, error) Authenticate(a *authenticator.TOTP, code string) error Get(ctx context.Context, userID, id string) (*authenticator.TOTP, error) GetMany(ctx context.Context, ids []string) ([]*authenticator.TOTP, error) List(ctx context.Context, userID string) ([]*authenticator.TOTP, error) Create(ctx context.Context, a *authenticator.TOTP) error Delete(ctx context.Context, a *authenticator.TOTP) error }
type UpdateOOBOTPTargetOption ¶
type UpdateOOBOTPTargetOption struct {
NewTarget string
}
type UpdatePasswordOptions ¶
type VerifyOptions ¶
type VerifyOptions struct { OOBChannel *model.AuthenticatorOOBChannel UseSubmittedValue bool Form otp.Form }
type VerifyResult ¶
type VerifyResult struct { Password *password.VerifyResult Passkey bool }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.