Documentation
¶
Index ¶
- type AllowNetworkParams
- type CapOIDCSessionsParams
- type ContinueAsOIDCSessionParams
- type CreateIdentityUserParams
- type DBTX
- type DeleteCheckParams
- type DropCheckParams
- type DueChecksParams
- type EndOtherUserSessionsParams
- type EndUserSessionsParams
- type FinishCheckParams
- type GetCheckUserParams
- type GetCheckUserRow
- type GetIdentityUserParams
- type GetIdentityUserRow
- type InsertAuthRequestParams
- type InsertDemoSettingsParams
- type InsertSettingsParams
- type LatestKeptAdminRow
- type LeaseChecksParams
- type LinkIdentityParams
- type LockCheckUserParams
- type LockCheckUserRow
- type LockLinkUserParams
- type LockLinkUserRow
- type LockUserParams
- type LockUserRow
- type LoginTakenParams
- type OidcSetting
- type PruneAuthRequestsParams
- type Queries
- func (q *Queries) AllowNetwork(ctx context.Context, arg AllowNetworkParams) (int64, error)
- func (q *Queries) CapOIDCSessions(ctx context.Context, arg CapOIDCSessionsParams) (int64, error)
- func (q *Queries) ContinueAsOIDCSession(ctx context.Context, arg ContinueAsOIDCSessionParams) (int64, error)
- func (q *Queries) CreateIdentityUser(ctx context.Context, arg CreateIdentityUserParams) (int64, error)
- func (q *Queries) DeleteCheck(ctx context.Context, arg DeleteCheckParams) error
- func (q *Queries) DropCheck(ctx context.Context, arg DropCheckParams) (int64, error)
- func (q *Queries) DueChecks(ctx context.Context, arg DueChecksParams) ([]int64, error)
- func (q *Queries) EndOtherUserSessions(ctx context.Context, arg EndOtherUserSessionsParams) (int64, error)
- func (q *Queries) EndUserSessions(ctx context.Context, arg EndUserSessionsParams) (int64, error)
- func (q *Queries) FinishCheck(ctx context.Context, arg FinishCheckParams) (int64, error)
- func (q *Queries) GetCheckUser(ctx context.Context, arg GetCheckUserParams) (GetCheckUserRow, error)
- func (q *Queries) GetIdentityUser(ctx context.Context, arg GetIdentityUserParams) (GetIdentityUserRow, error)
- func (q *Queries) GetSettings(ctx context.Context, orgID int64) (OidcSetting, error)
- func (q *Queries) InsertAuthRequest(ctx context.Context, arg InsertAuthRequestParams) (int64, error)
- func (q *Queries) InsertDemoSettings(ctx context.Context, arg InsertDemoSettingsParams) (int64, error)
- func (q *Queries) InsertSettings(ctx context.Context, arg InsertSettingsParams) (int64, error)
- func (q *Queries) LatestKeptAdmin(ctx context.Context, orgID int64) (LatestKeptAdminRow, error)
- func (q *Queries) LeaseChecks(ctx context.Context, arg LeaseChecksParams) error
- func (q *Queries) LinkIdentity(ctx context.Context, arg LinkIdentityParams) (int64, error)
- func (q *Queries) LockActiveAdmins(ctx context.Context, orgID int64) ([]int64, error)
- func (q *Queries) LockCheckUser(ctx context.Context, arg LockCheckUserParams) (LockCheckUserRow, error)
- func (q *Queries) LockLinkUser(ctx context.Context, arg LockLinkUserParams) (LockLinkUserRow, error)
- func (q *Queries) LockSettings(ctx context.Context, orgID int64) (int64, error)
- func (q *Queries) LockUser(ctx context.Context, arg LockUserParams) (LockUserRow, error)
- func (q *Queries) LoginTaken(ctx context.Context, arg LoginTakenParams) (bool, error)
- func (q *Queries) PruneAuthRequests(ctx context.Context, arg PruneAuthRequestsParams) (int64, error)
- func (q *Queries) RecordClaimsAdvertised(ctx context.Context, arg RecordClaimsAdvertisedParams) (int64, error)
- func (q *Queries) RecordClaimsSeen(ctx context.Context, arg RecordClaimsSeenParams) (int64, error)
- func (q *Queries) RecordContact(ctx context.Context, arg RecordContactParams) error
- func (q *Queries) RefuseUser(ctx context.Context, arg RefuseUserParams) error
- func (q *Queries) RenameDemoSettings(ctx context.Context, arg RenameDemoSettingsParams) (int64, error)
- func (q *Queries) ScheduleCheck(ctx context.Context, arg ScheduleCheckParams) error
- func (q *Queries) SetRole(ctx context.Context, arg SetRoleParams) (int64, error)
- func (q *Queries) StoreOfflineToken(ctx context.Context, arg StoreOfflineTokenParams) error
- func (q *Queries) TakeAuthRequest(ctx context.Context, arg TakeAuthRequestParams) (TakeAuthRequestRow, error)
- func (q *Queries) TakeLinkRequest(ctx context.Context, arg TakeLinkRequestParams) (TakeLinkRequestRow, error)
- func (q *Queries) UpdateSettings(ctx context.Context, arg UpdateSettingsParams) (int64, error)
- func (q *Queries) WipeOfflineToken(ctx context.Context, arg WipeOfflineTokenParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordClaimsAdvertisedParams
- type RecordClaimsSeenParams
- type RecordContactParams
- type RefuseUserParams
- type RenameDemoSettingsParams
- type ScheduleCheckParams
- type SetRoleParams
- type StoreOfflineTokenParams
- type TakeAuthRequestParams
- type TakeAuthRequestRow
- type TakeLinkRequestParams
- type TakeLinkRequestRow
- type UpdateSettingsParams
- type WipeOfflineTokenParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowNetworkParams ¶
type CapOIDCSessionsParams ¶
type DeleteCheckParams ¶
type DropCheckParams ¶
type DueChecksParams ¶
type EndUserSessionsParams ¶
type FinishCheckParams ¶
type GetCheckUserRow ¶
type GetIdentityUserParams ¶
type GetIdentityUserRow ¶
type InsertAuthRequestParams ¶
type InsertSettingsParams ¶
type InsertSettingsParams struct {
OrgID int64
Enabled bool
DisplayName pgtype.Text
IssuerUrl string
ClientID string
ClientSecretCiphertext []byte
ClientSecretKeyID pgtype.Text
ClientSecretUpdatedAt pgtype.Timestamptz
ClientSecretExpiresOn pgtype.Date
Scopes []string
GroupsClaim string
GroupMappings []byte
RoleMappings []byte
UnmatchedRole string
SyncRole bool
SkipTotpWithIdpMfa bool
Proxy []byte
ProxyPasswordCiphertext []byte
ProxyPasswordKeyID pgtype.Text
ProxyPasswordUpdatedAt pgtype.Timestamptz
ManagedBy pgtype.Text
UpdatedAt time.Time
}
type LatestKeptAdminRow ¶
type LeaseChecksParams ¶
type LinkIdentityParams ¶
type LockCheckUserParams ¶
type LockCheckUserRow ¶
type LockCheckUserRow struct {
Role string
Status string
OidcOfflineTokenUpdatedAt pgtype.Timestamptz
}
type LockLinkUserParams ¶
type LockLinkUserRow ¶
type LockUserParams ¶
type LockUserRow ¶
type LoginTakenParams ¶
type OidcSetting ¶
type OidcSetting struct {
OrgID int64
Enabled bool
DisplayName pgtype.Text
IssuerUrl string
ClientID string
ClientSecretCiphertext []byte
ClientSecretKeyID pgtype.Text
ClientSecretUpdatedAt pgtype.Timestamptz
ClientSecretExpiresOn pgtype.Date
Scopes []string
GroupsClaim string
GroupMappings []byte
UnmatchedRole string
SyncRole bool
SkipTotpWithIdpMfa bool
Proxy []byte
ProxyPasswordCiphertext []byte
ProxyPasswordKeyID pgtype.Text
ProxyPasswordUpdatedAt pgtype.Timestamptz
GroupsClaimMissingSince pgtype.Timestamptz
Version int64
UpdatedAt time.Time
GroupsClaimSeenAt pgtype.Timestamptz
RoleMappings []byte
ClaimsSeen []byte
ClaimsMissing []string
ClaimsSupported []string
ManagedBy pgtype.Text
}
type PruneAuthRequestsParams ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AllowNetwork ¶
AllowNetwork adds a network to the Organization's allowed outbound networks when it is not listed; `muster dev` allows loopback this way so that Muster may call the fake servers.
func (*Queries) CapOIDCSessions ¶
CapOIDCSessions bounds the open OIDC sessions of a user who no longer holds an offline token to @expires_at, since no background re-check can end them any more.
func (*Queries) ContinueAsOIDCSession ¶
func (q *Queries) ContinueAsOIDCSession(ctx context.Context, arg ContinueAsOIDCSessionParams) (int64, error)
ContinueAsOIDCSession turns the web session that linked an identity into an OIDC session; without an offline token it ends at @expires_at at the latest.
func (*Queries) CreateIdentityUser ¶
func (q *Queries) CreateIdentityUser(ctx context.Context, arg CreateIdentityUserParams) (int64, error)
CreateIdentityUser creates the account of an OIDC identity at its first sign-in.
func (*Queries) DeleteCheck ¶
func (q *Queries) DeleteCheck(ctx context.Context, arg DeleteCheckParams) error
DeleteCheck removes the re-check of a user who holds no offline token any more.
func (*Queries) DropCheck ¶
DropCheck removes a re-check that still holds its lease, when the identity provider refused the user; no row means the lease was lost.
func (*Queries) DueChecks ¶
DueChecks locks up to batch_size re-checks that are due on the business clock and not leased on the real clock, skipping those another replica holds.
func (*Queries) EndOtherUserSessions ¶
func (q *Queries) EndOtherUserSessions(ctx context.Context, arg EndOtherUserSessionsParams) (int64, error)
EndOtherUserSessions ends every session of a user but the one that made the change, with the reason.
func (*Queries) EndUserSessions ¶
EndUserSessions ends every session of a user that has not ended, with the reason.
func (*Queries) FinishCheck ¶
FinishCheck records the outcome of a re-check that still holds its lease, makes it due again at @deadline and releases the lease; no row means the lease was lost and the outcome must not be recorded.
func (*Queries) GetCheckUser ¶
func (q *Queries) GetCheckUser(ctx context.Context, arg GetCheckUserParams) (GetCheckUserRow, error)
GetCheckUser reads the user of a claimed re-check: the offline token and when it was stored, and whether the user has a live session or a Personal access token that has not expired, at @now on the business clock.
func (*Queries) GetIdentityUser ¶
func (q *Queries) GetIdentityUser(ctx context.Context, arg GetIdentityUserParams) (GetIdentityUserRow, error)
GetIdentityUser finds the account that holds an OIDC identity, with whether it has TOTP and the Organization's TOTP policy.
func (*Queries) GetSettings ¶
SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors GetSettings reads the OIDC settings of the Organization, with the state of their Secrets.
func (*Queries) InsertAuthRequest ¶
func (q *Queries) InsertAuthRequest(ctx context.Context, arg InsertAuthRequestParams) (int64, error)
InsertAuthRequest stores an OIDC redirect in flight, keyed by the hash of its state, unless the Organization already has max_pending requests that have not expired: starts need no credentials, so their rows are bounded.
func (*Queries) InsertDemoSettings ¶
func (q *Queries) InsertDemoSettings(ctx context.Context, arg InsertDemoSettingsParams) (int64, error)
InsertDemoSettings stores the demo OIDC configuration of `muster dev` when the Organization has none.
func (*Queries) InsertSettings ¶
InsertSettings stores the first OIDC settings of the Organization; it changes nothing when they exist, so that two first saves at once leave one row and the second answers a version mismatch. role_mappings holds every entry of the Role mapping; group_mappings, which a replica of 0.1 reads, only those it reads the same way.
func (*Queries) LatestKeptAdmin ¶
LatestKeptAdmin reads the latest entry in which Role sync kept the last active Admin, with the user it names, that user's last OIDC contact and how many active Admins there are now.
func (*Queries) LeaseChecks ¶
func (q *Queries) LeaseChecks(ctx context.Context, arg LeaseChecksParams) error
LeaseChecks leases the re-checks DueChecks locked to this replica until @lease_until on the real clock.
func (*Queries) LinkIdentity ¶
LinkIdentity adds the OIDC identity to an active account with a password and wipes the password in the same update, so that the account never holds both (users_one_credential_check).
func (*Queries) LockActiveAdmins ¶
LockActiveAdmins locks the rows of the active Admins, as the last_admin check of user administration does, before the row of the user whose Role sync may lower an Admin.
func (*Queries) LockCheckUser ¶
func (q *Queries) LockCheckUser(ctx context.Context, arg LockCheckUserParams) (LockCheckUserRow, error)
LockCheckUser locks the user whose re-check ends and reads the offline token it holds now.
func (*Queries) LockLinkUser ¶
func (q *Queries) LockLinkUser(ctx context.Context, arg LockLinkUserParams) (LockLinkUserRow, error)
LockLinkUser locks the account a link adds the identity to and reads whether it can take one: active, with a password and without an identity.
func (*Queries) LockSettings ¶
LockSettings locks the settings row until the transaction ends and returns its version.
func (*Queries) LockUser ¶
func (q *Queries) LockUser(ctx context.Context, arg LockUserParams) (LockUserRow, error)
LockUser locks the user whose Role sync runs and reads the Role and status it has now.
func (*Queries) LoginTaken ¶
LoginTaken reports whether an account has the login, compared lowercased.
func (*Queries) PruneAuthRequests ¶
func (q *Queries) PruneAuthRequests(ctx context.Context, arg PruneAuthRequestsParams) (int64, error)
PruneAuthRequests deletes up to batch_size requests that expired before @before. A request being taken is skipped and goes at the next run.
func (*Queries) RecordClaimsAdvertised ¶
func (q *Queries) RecordClaimsAdvertised(ctx context.Context, arg RecordClaimsAdvertisedParams) (int64, error)
RecordClaimsAdvertised records what a check found in discovery: the claims it listed, and @missing, the claims the mapping reads that it did not list and no sign-in has seen. A claim is shown as missing only while no sign-in has seen it, since discovery's list of claims is optional and identity providers leave the claims of their mappers out of it. The groups claim is also recorded in groups_claim_missing_since, which a replica of 0.1 reads: an unlisted claim raises it while no sign-in has seen the claim, a listed one clears it, and a warning that an older replica raised next to a claim seen is cleared. It changes nothing when an Admin saved another groups claim, issuer, client ID or scopes since the check read them, and writes no row when nothing changes.
func (*Queries) RecordClaimsSeen ¶
RecordClaimsSeen records the claims that a sign-in or a link found in an ID token or in userinfo, each in claims_seen as {"at": the first time, "id_token": whether the refreshed ID token of a re-check ever carried it} — @id_token_claims are those the refreshed ID token of this re-check carried, none at a sign-in — and clears its warning for good, until an Admin saves another groups claim, issuer, client ID or scopes; the groups claim is also recorded in groups_claim_seen_at and groups_claim_missing_since, which a replica of 0.1 reads. A claim a sign-in lacks is not recorded: identity providers leave a claim out for a user in no group. It changes nothing when an Admin saved other values of those four since the sign-in read them, and writes no row when every claim is already seen, where it was seen, and none is missing. The warnings are not configured values, so the version stays.
func (*Queries) RecordContact ¶
func (q *Queries) RecordContact(ctx context.Context, arg RecordContactParams) error
RecordContact records a successful contact with the identity provider and lifts an earlier refusal.
func (*Queries) RefuseUser ¶
func (q *Queries) RefuseUser(ctx context.Context, arg RefuseUserParams) error
RefuseUser records that the identity provider refused the user at a re-check and wipes the offline token.
func (*Queries) RenameDemoSettings ¶
func (q *Queries) RenameDemoSettings(ctx context.Context, arg RenameDemoSettingsParams) (int64, error)
RenameDemoSettings gives the settings that still carry the demo configuration's earlier display name its current one; `muster dev` runs it at start, and any other settings stay as they are.
func (*Queries) ScheduleCheck ¶
func (q *Queries) ScheduleCheck(ctx context.Context, arg ScheduleCheckParams) error
ScheduleCheck makes the re-check of a user who holds an offline token due at @deadline; a re-check in flight for the token it replaced loses its lease, so that its outcome is not recorded.
func (*Queries) StoreOfflineToken ¶
func (q *Queries) StoreOfflineToken(ctx context.Context, arg StoreOfflineTokenParams) error
StoreOfflineToken keeps the offline token the identity provider granted, encrypted, in place of the previous one.
func (*Queries) TakeAuthRequest ¶
func (q *Queries) TakeAuthRequest(ctx context.Context, arg TakeAuthRequestParams) (TakeAuthRequestRow, error)
TakeAuthRequest removes and returns the request of a state, so that a callback uses it once.
func (*Queries) TakeLinkRequest ¶
func (q *Queries) TakeLinkRequest(ctx context.Context, arg TakeLinkRequestParams) (TakeLinkRequestRow, error)
TakeLinkRequest removes and returns the link request of a state only for the web session that started it, so that a callback in another session neither uses nor spends it.
func (*Queries) UpdateSettings ¶
UpdateSettings replaces the settings at the version that was read. Another groups claim, issuer, client ID or scopes forgets which claims sign-ins carried and which the last check found missing; another issuer forgets what its discovery listed.
func (*Queries) WipeOfflineToken ¶
func (q *Queries) WipeOfflineToken(ctx context.Context, arg WipeOfflineTokenParams) error
WipeOfflineToken removes the offline token of a user whose sign-in granted none.
type RecordClaimsSeenParams ¶
type ScheduleCheckParams ¶
type StoreOfflineTokenParams ¶
type TakeAuthRequestParams ¶
type TakeAuthRequestRow ¶
type TakeLinkRequestParams ¶
type TakeLinkRequestRow ¶
type UpdateSettingsParams ¶
type UpdateSettingsParams struct {
Enabled bool
DisplayName pgtype.Text
IssuerUrl string
ClientID string
ClientSecretCiphertext []byte
ClientSecretKeyID pgtype.Text
ClientSecretUpdatedAt pgtype.Timestamptz
ClientSecretExpiresOn pgtype.Date
Scopes []string
GroupsClaim string
GroupMappings []byte
RoleMappings []byte
UnmatchedRole string
SyncRole bool
SkipTotpWithIdpMfa bool
Proxy []byte
ProxyPasswordCiphertext []byte
ProxyPasswordKeyID pgtype.Text
ProxyPasswordUpdatedAt pgtype.Timestamptz
ManagedBy pgtype.Text
UpdatedAt time.Time
OrgID int64
Version int64
}