Documentation
¶
Index ¶
- type BlockSignInParams
- type CompleteSecondFactorParams
- type CreateSessionParams
- type DBTX
- type EndOtherUserSessionsParams
- type EndSessionParams
- type EndUserSessionsParams
- type GetSessionByTokenParams
- type GetSessionByTokenRow
- type GetSignInUserParams
- type GetSignInUserRow
- type GetThrottlesParams
- type GetThrottlesRow
- type GetUserPasswordParams
- type GetUserPasswordRow
- type ListUserSessionsParams
- type ListUserSessionsRow
- type LiveSessionsParams
- type MarkSignedInParams
- type PruneSessionsParams
- type PruneSignInThrottlesParams
- type Queries
- func (q *Queries) BlockSignIn(ctx context.Context, arg BlockSignInParams) error
- func (q *Queries) CompleteSecondFactor(ctx context.Context, arg CompleteSecondFactorParams) (int64, error)
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (int64, error)
- func (q *Queries) EndOtherUserSessions(ctx context.Context, arg EndOtherUserSessionsParams) (int64, error)
- func (q *Queries) EndSession(ctx context.Context, arg EndSessionParams) (int64, error)
- func (q *Queries) EndUserSessions(ctx context.Context, arg EndUserSessionsParams) (int64, error)
- func (q *Queries) GetSessionByToken(ctx context.Context, arg GetSessionByTokenParams) (GetSessionByTokenRow, error)
- func (q *Queries) GetSignInUser(ctx context.Context, arg GetSignInUserParams) (GetSignInUserRow, error)
- func (q *Queries) GetThrottles(ctx context.Context, arg GetThrottlesParams) ([]GetThrottlesRow, error)
- func (q *Queries) GetUserPassword(ctx context.Context, arg GetUserPasswordParams) (GetUserPasswordRow, error)
- func (q *Queries) ListRolePermissions(ctx context.Context) ([]RolePermission, error)
- func (q *Queries) ListUserSessions(ctx context.Context, arg ListUserSessionsParams) ([]ListUserSessionsRow, error)
- func (q *Queries) LiveSessions(ctx context.Context, arg LiveSessionsParams) ([]int64, error)
- func (q *Queries) MarkSignedIn(ctx context.Context, arg MarkSignedInParams) error
- func (q *Queries) PruneSessions(ctx context.Context, arg PruneSessionsParams) (int64, error)
- func (q *Queries) PruneSignInThrottles(ctx context.Context, arg PruneSignInThrottlesParams) (int64, error)
- func (q *Queries) RecordSignInFailure(ctx context.Context, arg RecordSignInFailureParams) (int64, error)
- func (q *Queries) ResetSignInThrottles(ctx context.Context, arg ResetSignInThrottlesParams) error
- func (q *Queries) SetPassword(ctx context.Context, arg SetPasswordParams) (int64, error)
- func (q *Queries) TouchSession(ctx context.Context, arg TouchSessionParams) error
- func (q *Queries) TryLockSignInSubject(ctx context.Context, arg TryLockSignInSubjectParams) (bool, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordSignInFailureParams
- type ResetSignInThrottlesParams
- type RolePermission
- type SetPasswordParams
- type TouchSessionParams
- type TryLockSignInSubjectParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockSignInParams ¶
type BlockSignInParams struct {
BlockedUntil pgtype.Timestamptz
OrgID int64
SubjectKind string
Subject string
}
type CreateSessionParams ¶
type EndSessionParams ¶
type EndUserSessionsParams ¶
type GetSessionByTokenParams ¶
type GetSessionByTokenRow ¶
type GetSessionByTokenRow struct {
ID int64
PublicID string
UserID int64
State string
Method string
Address *netip.Addr
UserAgent pgtype.Text
CreatedAt time.Time
LastUsedAt time.Time
IdleExpiresAt time.Time
ExpiresAt time.Time
EndedAt pgtype.Timestamptz
EndReason pgtype.Text
UserPublicID string
UserName string
UserRole string
UserStatus string
}
type GetSignInUserParams ¶
type GetSignInUserRow ¶
type GetThrottlesParams ¶
type GetThrottlesRow ¶
type GetThrottlesRow struct {
SubjectKind string
ConsecutiveFailures int64
BlockedUntil pgtype.Timestamptz
}
type GetUserPasswordParams ¶
type GetUserPasswordRow ¶
type ListUserSessionsParams ¶
type ListUserSessionsRow ¶
type PruneSessionsParams ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) BlockSignIn ¶
func (q *Queries) BlockSignIn(ctx context.Context, arg BlockSignInParams) error
func (*Queries) CompleteSecondFactor ¶
func (q *Queries) CompleteSecondFactor(ctx context.Context, arg CompleteSecondFactorParams) (int64, error)
CompleteSecondFactor makes a session that waited for the TOTP code active.
func (*Queries) CreateSession ¶
func (*Queries) EndOtherUserSessions ¶
func (*Queries) EndSession ¶
func (*Queries) EndUserSessions ¶
func (*Queries) GetSessionByToken ¶
func (q *Queries) GetSessionByToken(ctx context.Context, arg GetSessionByTokenParams) (GetSessionByTokenRow, error)
GetSessionByToken finds a session by the hash of its cookie value, with its user.
func (*Queries) GetSignInUser ¶
func (q *Queries) GetSignInUser(ctx context.Context, arg GetSignInUserParams) (GetSignInUserRow, error)
GetSignInUser finds the account of a login, compared lowercased, with whether it has TOTP and the Organization's TOTP policy.
func (*Queries) GetThrottles ¶
func (q *Queries) GetThrottles(ctx context.Context, arg GetThrottlesParams) ([]GetThrottlesRow, error)
func (*Queries) GetUserPassword ¶
func (q *Queries) GetUserPassword(ctx context.Context, arg GetUserPasswordParams) (GetUserPasswordRow, error)
func (*Queries) ListRolePermissions ¶
func (q *Queries) ListRolePermissions(ctx context.Context) ([]RolePermission, error)
SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors ListRolePermissions reads the allocation of Permissions to Roles, reference data without org_id.
func (*Queries) ListUserSessions ¶
func (q *Queries) ListUserSessions(ctx context.Context, arg ListUserSessionsParams) ([]ListUserSessionsRow, error)
ListUserSessions lists the sessions of a user that have neither ended nor expired, the latest used first.
func (*Queries) LiveSessions ¶
LiveSessions returns which of the sessions are still usable at @now: active, neither ended nor expired, of an active user. Reading them does not count as a use.
func (*Queries) MarkSignedIn ¶
func (q *Queries) MarkSignedIn(ctx context.Context, arg MarkSignedInParams) error
func (*Queries) PruneSessions ¶
PruneSessions deletes up to batch_size sessions that could no longer be used before @before: ended, past their idle timeout or past their lifetime. A session row being used is skipped and taken at the next run.
func (*Queries) PruneSignInThrottles ¶
func (q *Queries) PruneSignInThrottles(ctx context.Context, arg PruneSignInThrottlesParams) (int64, error)
PruneSignInThrottles deletes up to batch_size throttle rows whose last failure, and whose block, are older than @before. A row being counted is skipped and taken at the next run.
func (*Queries) RecordSignInFailure ¶
func (q *Queries) RecordSignInFailure(ctx context.Context, arg RecordSignInFailureParams) (int64, error)
RecordSignInFailure counts one more consecutive failure of a subject and returns the count.
func (*Queries) ResetSignInThrottles ¶
func (q *Queries) ResetSignInThrottles(ctx context.Context, arg ResetSignInThrottlesParams) error
ResetSignInThrottles forgets the failures of an account and of a source address after a successful sign-in.
func (*Queries) SetPassword ¶
SetPassword replaces the password of a local account.
func (*Queries) TouchSession ¶
func (q *Queries) TouchSession(ctx context.Context, arg TouchSessionParams) error
TouchSession records the use of a session, at most once a minute, and moves its idle expiry.
func (*Queries) TryLockSignInSubject ¶
func (q *Queries) TryLockSignInSubject(ctx context.Context, arg TryLockSignInSubjectParams) (bool, error)
TryLockSignInSubject takes the attempt lock of an account until the transaction ends, without waiting; false means that another attempt of the account is being evaluated. The two-key advisory locks do not overlap the one-key locks of the migrations and the Leader.