Documentation ¶
Index ¶
- Constants
- func WithDisabledLogging(v bool) persisterOption
- func WithExtraMigrations(fss ...fs.FS) persisterOption
- func WithTransaction(ctx context.Context, tx *pop.Connection) context.Context
- type Persister
- func (p *Persister) AddMessage(ctx context.Context, m *courier.Message) (err error)
- func (p *Persister) CleanupDatabase(ctx context.Context, wait time.Duration, older time.Duration, batchSize int) error
- func (p *Persister) ClearErrorContainers(ctx context.Context, olderThan time.Duration, force bool) (err error)
- func (p *Persister) Close(ctx context.Context) error
- func (p *Persister) CodeForFlow(ctx context.Context, flowID uuid.UUID) (codes *sessiontokenexchange.Codes, found bool, err error)
- func (p *Persister) Connection(ctx context.Context) *pop.Connection
- func (p *Persister) CreateErrorContainer(ctx context.Context, csrfToken string, errs error) (containerID uuid.UUID, err error)
- func (p *Persister) CreateLoginCode(ctx context.Context, params *code.CreateLoginCodeParams) (_ *code.LoginCode, err error)
- func (p *Persister) CreateLoginFlow(ctx context.Context, r *login.Flow) (err error)
- func (p *Persister) CreateRecoveryCode(ctx context.Context, params *code.CreateRecoveryCodeParams) (_ *code.RecoveryCode, err error)
- func (p *Persister) CreateRecoveryFlow(ctx context.Context, r *recovery.Flow) (err error)
- func (p *Persister) CreateRecoveryToken(ctx context.Context, token *link.RecoveryToken) (err error)
- func (p *Persister) CreateRegistrationCode(ctx context.Context, params *code.CreateRegistrationCodeParams) (_ *code.RegistrationCode, err error)
- func (p *Persister) CreateRegistrationFlow(ctx context.Context, r *registration.Flow) (err error)
- func (p *Persister) CreateSessionTokenExchanger(ctx context.Context, flowID uuid.UUID) (e *sessiontokenexchange.Exchanger, err error)
- func (p *Persister) CreateSettingsFlow(ctx context.Context, r *settings.Flow) (err error)
- func (p *Persister) CreateVerificationCode(ctx context.Context, params *code.CreateVerificationCodeParams) (_ *code.VerificationCode, err error)
- func (p *Persister) CreateVerificationFlow(ctx context.Context, r *verification.Flow) (err error)
- func (p *Persister) CreateVerificationToken(ctx context.Context, token *link.VerificationToken) (err error)
- func (p *Persister) DeleteContinuitySession(ctx context.Context, id uuid.UUID) (err error)
- func (p *Persister) DeleteExpiredContinuitySessions(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteExpiredExchangers(ctx context.Context, at time.Time, limit int) error
- func (p *Persister) DeleteExpiredLoginFlows(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteExpiredRecoveryFlows(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteExpiredRegistrationFlows(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteExpiredSessions(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteExpiredSettingsFlows(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteExpiredVerificationFlows(ctx context.Context, expiresAt time.Time, limit int) (err error)
- func (p *Persister) DeleteLoginCodesOfFlow(ctx context.Context, flowID uuid.UUID) (err error)
- func (p *Persister) DeleteRecoveryCodesOfFlow(ctx context.Context, flowID uuid.UUID) (err error)
- func (p *Persister) DeleteRecoveryToken(ctx context.Context, token string) (err error)
- func (p *Persister) DeleteRegistrationCodesOfFlow(ctx context.Context, flowID uuid.UUID) (err error)
- func (p *Persister) DeleteSession(ctx context.Context, sid uuid.UUID) (err error)
- func (p *Persister) DeleteSessionByToken(ctx context.Context, token string) (err error)
- func (p *Persister) DeleteSessionsByIdentity(ctx context.Context, identityID uuid.UUID) (err error)
- func (p *Persister) DeleteVerificationCodesOfFlow(ctx context.Context, fID uuid.UUID) (err error)
- func (p *Persister) DeleteVerificationToken(ctx context.Context, token string) (err error)
- func (p *Persister) DetermineNetwork(ctx context.Context) (*networkx.Network, error)
- func (p *Persister) ExtendSession(ctx context.Context, sessionID uuid.UUID) (err error)
- func (p *Persister) FetchMessage(ctx context.Context, msgID uuid.UUID) (_ *courier.Message, err error)
- func (p *Persister) ForceLoginFlow(ctx context.Context, id uuid.UUID) (err error)
- func (p *Persister) GetConnection(ctx context.Context) *pop.Connection
- func (p *Persister) GetContinuitySession(ctx context.Context, id uuid.UUID) (_ *continuity.Container, err error)
- func (p *Persister) GetExchangerFromCode(ctx context.Context, initCode string, returnToCode string) (e *sessiontokenexchange.Exchanger, err error)
- func (p *Persister) GetLoginFlow(ctx context.Context, id uuid.UUID) (_ *login.Flow, err error)
- func (p *Persister) GetRecoveryFlow(ctx context.Context, id uuid.UUID) (_ *recovery.Flow, err error)
- func (p *Persister) GetRegistrationFlow(ctx context.Context, id uuid.UUID) (_ *registration.Flow, err error)
- func (p *Persister) GetSession(ctx context.Context, sid uuid.UUID, expandables session.Expandables) (_ *session.Session, err error)
- func (p *Persister) GetSessionByToken(ctx context.Context, token string, expand session.Expandables, ...) (res *session.Session, err error)
- func (p *Persister) GetSettingsFlow(ctx context.Context, id uuid.UUID) (_ *settings.Flow, err error)
- func (p *Persister) GetUsedLoginCode(ctx context.Context, flowID uuid.UUID) (_ *code.LoginCode, err error)
- func (p *Persister) GetUsedRegistrationCode(ctx context.Context, flowID uuid.UUID) (_ *code.RegistrationCode, err error)
- func (p *Persister) GetVerificationFlow(ctx context.Context, id uuid.UUID) (_ *verification.Flow, err error)
- func (p *Persister) IncrementMessageSendCount(ctx context.Context, id uuid.UUID) (err error)
- func (p *Persister) LatestQueuedMessage(ctx context.Context) (_ *courier.Message, err error)
- func (p *Persister) ListMessages(ctx context.Context, filter courier.ListCourierMessagesParameters, ...) (_ []courier.Message, _ int64, _ *keysetpagination.Paginator, err error)
- func (p *Persister) ListSessions(ctx context.Context, active *bool, paginatorOpts []keysetpagination.Option, ...) (_ []session.Session, _ int64, _ *keysetpagination.Paginator, err error)
- func (p *Persister) ListSessionsByIdentity(ctx context.Context, iID uuid.UUID, active *bool, page, perPage int, ...) (_ []session.Session, _ int64, err error)
- func (p *Persister) MigrateDown(ctx context.Context, steps int) error
- func (p *Persister) MigrateUp(ctx context.Context) error
- func (p *Persister) MigrationBox() *popx.MigrationBox
- func (p *Persister) MigrationStatus(ctx context.Context) (_ popx.MigrationStatuses, err error)
- func (p *Persister) Migrator() *popx.Migrator
- func (p *Persister) MoveToNewFlow(ctx context.Context, oldFlow, newFlow uuid.UUID) (err error)
- func (p *Persister) NetworkID(ctx context.Context) uuid.UUID
- func (p *Persister) NextMessages(ctx context.Context, limit uint8) (messages []courier.Message, err error)
- func (p *Persister) Ping() error
- func (p *Persister) ReadErrorContainer(ctx context.Context, id uuid.UUID) (_ *errorx.ErrorContainer, err error)
- func (p *Persister) RecordDispatch(ctx context.Context, msgID uuid.UUID, ...) error
- func (p *Persister) RevokeSession(ctx context.Context, iID, sID uuid.UUID) (err error)
- func (p *Persister) RevokeSessionById(ctx context.Context, sID uuid.UUID) (err error)
- func (p *Persister) RevokeSessionByToken(ctx context.Context, token string) (err error)
- func (p *Persister) RevokeSessionsIdentityExcept(ctx context.Context, iID, sID uuid.UUID) (res int, err error)
- func (p *Persister) SaveContinuitySession(ctx context.Context, c *continuity.Container) (err error)
- func (p *Persister) SetContinuitySessionExpiry(ctx context.Context, id uuid.UUID, expiresAt time.Time) (err error)
- func (p *Persister) SetMessageStatus(ctx context.Context, id uuid.UUID, ms courier.MessageStatus) (err error)
- func (p *Persister) Transaction(ctx context.Context, ...) error
- func (p *Persister) UpdateLoginFlow(ctx context.Context, r *login.Flow) (err error)
- func (p *Persister) UpdateRecoveryFlow(ctx context.Context, r *recovery.Flow) (err error)
- func (p *Persister) UpdateRegistrationFlow(ctx context.Context, r *registration.Flow) (err error)
- func (p *Persister) UpdateSessionOnExchanger(ctx context.Context, flowID uuid.UUID, sessionID uuid.UUID) (err error)
- func (p *Persister) UpdateSettingsFlow(ctx context.Context, r *settings.Flow) (err error)
- func (p *Persister) UpdateVerificationFlow(ctx context.Context, r *verification.Flow) (err error)
- func (p *Persister) UpsertSession(ctx context.Context, s *session.Session) (err error)
- func (p *Persister) UseLoginCode(ctx context.Context, flowID uuid.UUID, identityID uuid.UUID, ...) (_ *code.LoginCode, err error)
- func (p *Persister) UseRecoveryCode(ctx context.Context, flowID uuid.UUID, userProvidedCode string) (_ *code.RecoveryCode, err error)
- func (p *Persister) UseRecoveryToken(ctx context.Context, fID uuid.UUID, token string) (_ *link.RecoveryToken, err error)
- func (p *Persister) UseRegistrationCode(ctx context.Context, flowID uuid.UUID, userProvidedCode string, ...) (_ *code.RegistrationCode, err error)
- func (p *Persister) UseVerificationCode(ctx context.Context, flowID uuid.UUID, userProvidedCode string) (_ *code.VerificationCode, err error)
- func (p *Persister) UseVerificationToken(ctx context.Context, fID uuid.UUID, token string) (_ *link.VerificationToken, err error)
- func (p Persister) WithNetworkID(nid uuid.UUID) persistence.Persister
Constants ¶
const ( SessionDeviceUserAgentMaxLength = 512 SessionDeviceLocationMaxLength = 512 )
Variables ¶
This section is empty.
Functions ¶
func WithDisabledLogging ¶ added in v1.1.0
func WithDisabledLogging(v bool) persisterOption
func WithExtraMigrations ¶ added in v1.1.0
Types ¶
type Persister ¶
type Persister struct { identity.PrivilegedPool session.DevicePersister // contains filtered or unexported fields }
func NewPersister ¶
func (*Persister) AddMessage ¶
func (*Persister) CleanupDatabase ¶ added in v0.11.0
func (*Persister) ClearErrorContainers ¶ added in v0.13.0
func (*Persister) CodeForFlow ¶ added in v1.0.0
func (*Persister) Connection ¶
func (*Persister) CreateErrorContainer ¶ added in v0.13.0
func (*Persister) CreateLoginCode ¶ added in v1.1.0
func (*Persister) CreateLoginFlow ¶
func (*Persister) CreateRecoveryCode ¶ added in v0.11.0
func (p *Persister) CreateRecoveryCode(ctx context.Context, params *code.CreateRecoveryCodeParams) (_ *code.RecoveryCode, err error)
func (*Persister) CreateRecoveryFlow ¶
func (*Persister) CreateRecoveryToken ¶
func (*Persister) CreateRegistrationCode ¶ added in v1.1.0
func (p *Persister) CreateRegistrationCode(ctx context.Context, params *code.CreateRegistrationCodeParams) (_ *code.RegistrationCode, err error)
func (*Persister) CreateRegistrationFlow ¶
func (*Persister) CreateSessionTokenExchanger ¶ added in v1.0.0
func (*Persister) CreateSettingsFlow ¶
func (*Persister) CreateVerificationCode ¶ added in v0.11.0
func (p *Persister) CreateVerificationCode(ctx context.Context, params *code.CreateVerificationCodeParams) (_ *code.VerificationCode, err error)
func (*Persister) CreateVerificationFlow ¶
func (*Persister) CreateVerificationToken ¶
func (*Persister) DeleteContinuitySession ¶
func (*Persister) DeleteExpiredContinuitySessions ¶ added in v0.11.0
func (*Persister) DeleteExpiredExchangers ¶ added in v1.0.0
func (*Persister) DeleteExpiredLoginFlows ¶ added in v0.11.0
func (*Persister) DeleteExpiredRecoveryFlows ¶ added in v0.11.0
func (*Persister) DeleteExpiredRegistrationFlows ¶ added in v0.11.0
func (*Persister) DeleteExpiredSessions ¶ added in v0.11.0
func (*Persister) DeleteExpiredSettingsFlows ¶ added in v0.11.0
func (*Persister) DeleteExpiredVerificationFlows ¶ added in v0.11.0
func (*Persister) DeleteLoginCodesOfFlow ¶ added in v1.1.0
func (*Persister) DeleteRecoveryCodesOfFlow ¶ added in v0.11.0
func (*Persister) DeleteRecoveryToken ¶
func (*Persister) DeleteRegistrationCodesOfFlow ¶ added in v1.1.0
func (*Persister) DeleteSession ¶
func (*Persister) DeleteSessionByToken ¶
func (*Persister) DeleteSessionsByIdentity ¶
func (*Persister) DeleteVerificationCodesOfFlow ¶ added in v0.11.0
func (*Persister) DeleteVerificationToken ¶
func (*Persister) DetermineNetwork ¶
func (*Persister) ExtendSession ¶ added in v1.3.0
ExtendSession updates the expiry of a session.
func (*Persister) FetchMessage ¶ added in v0.11.1
func (*Persister) ForceLoginFlow ¶
func (*Persister) GetConnection ¶
func (*Persister) GetContinuitySession ¶
func (*Persister) GetExchangerFromCode ¶ added in v1.0.0
func (*Persister) GetLoginFlow ¶
func (*Persister) GetRecoveryFlow ¶
func (*Persister) GetRegistrationFlow ¶
func (*Persister) GetSession ¶
func (*Persister) GetSessionByToken ¶
func (*Persister) GetSettingsFlow ¶
func (*Persister) GetUsedLoginCode ¶ added in v1.1.0
func (*Persister) GetUsedRegistrationCode ¶ added in v1.1.0
func (*Persister) GetVerificationFlow ¶
func (*Persister) IncrementMessageSendCount ¶ added in v0.11.0
func (*Persister) LatestQueuedMessage ¶
func (*Persister) ListMessages ¶ added in v0.11.0
func (p *Persister) ListMessages(ctx context.Context, filter courier.ListCourierMessagesParameters, opts []keysetpagination.Option) (_ []courier.Message, _ int64, _ *keysetpagination.Paginator, err error)
func (*Persister) ListSessions ¶ added in v0.11.0
func (p *Persister) ListSessions(ctx context.Context, active *bool, paginatorOpts []keysetpagination.Option, expandables session.Expandables) (_ []session.Session, _ int64, _ *keysetpagination.Paginator, err error)
func (*Persister) ListSessionsByIdentity ¶
func (p *Persister) ListSessionsByIdentity( ctx context.Context, iID uuid.UUID, active *bool, page, perPage int, except uuid.UUID, expandables session.Expandables, ) (_ []session.Session, _ int64, err error)
ListSessionsByIdentity retrieves sessions for an identity from the store.
func (*Persister) MigrateDown ¶
func (*Persister) MigrationBox ¶ added in v0.13.0
func (p *Persister) MigrationBox() *popx.MigrationBox
func (*Persister) MigrationStatus ¶
func (*Persister) MoveToNewFlow ¶ added in v1.0.0
func (*Persister) NextMessages ¶
func (*Persister) ReadErrorContainer ¶ added in v0.13.0
func (*Persister) RecordDispatch ¶ added in v0.11.1
func (*Persister) RevokeSession ¶
RevokeSession revokes a given session. If the session does not exist or was not modified, it effectively has been revoked already, and therefore that case does not return an error.
func (*Persister) RevokeSessionById ¶ added in v0.11.0
RevokeSessionById revokes a given session
func (*Persister) RevokeSessionByToken ¶
func (*Persister) RevokeSessionsIdentityExcept ¶
func (p *Persister) RevokeSessionsIdentityExcept(ctx context.Context, iID, sID uuid.UUID) (res int, err error)
RevokeSessionsIdentityExcept marks all except the given session of an identity inactive.
func (*Persister) SaveContinuitySession ¶
func (*Persister) SetContinuitySessionExpiry ¶ added in v1.2.0
func (*Persister) SetMessageStatus ¶
func (*Persister) Transaction ¶
func (*Persister) UpdateLoginFlow ¶
func (*Persister) UpdateRecoveryFlow ¶
func (*Persister) UpdateRegistrationFlow ¶
func (*Persister) UpdateSessionOnExchanger ¶ added in v1.0.0
func (*Persister) UpdateSettingsFlow ¶
func (*Persister) UpdateVerificationFlow ¶
func (*Persister) UpsertSession ¶
UpsertSession creates a session if not found else updates. This operation also inserts Session device records when a session is being created. The update operation skips updating Session device records since only one record would need to be updated in this case.
func (*Persister) UseLoginCode ¶ added in v1.1.0
func (*Persister) UseRecoveryCode ¶ added in v0.11.0
func (p *Persister) UseRecoveryCode(ctx context.Context, flowID uuid.UUID, userProvidedCode string) (_ *code.RecoveryCode, err error)
UseRecoveryCode attempts to "use" the supplied code in the flow
If the supplied code matched a code from the flow, no error is returned If an invalid code was submitted with this flow more than 5 times, an error is returned
func (*Persister) UseRecoveryToken ¶
func (*Persister) UseRegistrationCode ¶ added in v1.1.0
func (*Persister) UseVerificationCode ¶ added in v0.11.0
func (*Persister) UseVerificationToken ¶
func (Persister) WithNetworkID ¶
func (p Persister) WithNetworkID(nid uuid.UUID) persistence.Persister
Source Files ¶
- persister.go
- persister_code.go
- persister_continuity.go
- persister_courier.go
- persister_errorx.go
- persister_hmac.go
- persister_login.go
- persister_login_code.go
- persister_recovery.go
- persister_recovery_code.go
- persister_registration.go
- persister_registration_code.go
- persister_session.go
- persister_sessiontokenexchanger.go
- persister_settings.go
- persister_transaction_helpers.go
- persister_verification.go
- persister_verification_code.go