memory

package
v2.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package memory provides an in-process implementation of theauth.Storage backed by Go maps protected by a sync.RWMutex.

The store is intended for tests, examples, and local development; it retains state only for the lifetime of the process and offers no persistence guarantees. Production deployments should use storage/postgres or another durable backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New() *Store

func (*Store) APITokenByHash

func (s *Store) APITokenByHash(_ context.Context, hash []byte) (*theauth.APIToken, error)

func (*Store) APITokenByID

func (s *Store) APITokenByID(_ context.Context, id theauth.ULID) (*theauth.APIToken, error)

func (*Store) APITokensByOwner

func (s *Store) APITokensByOwner(_ context.Context, ownerID theauth.ULID) ([]theauth.APIToken, error)

func (*Store) AddGroupMembers

func (s *Store) AddGroupMembers(_ context.Context, groupID theauth.ULID, userIDs []theauth.ULID) error

func (*Store) AdvanceTOTPStep

func (s *Store) AdvanceTOTPStep(_ context.Context, userID theauth.ULID, step int64) (bool, error)

AdvanceTOTPStep implements theauth.TOTPReplayStorage.

func (*Store) AgentByClientID

func (s *Store) AgentByClientID(_ context.Context, clientID string) (*theauth.Agent, error)

func (*Store) AgentByID

func (s *Store) AgentByID(_ context.Context, id theauth.ULID) (*theauth.Agent, error)

func (*Store) AgentCredentialsByAgentID

func (s *Store) AgentCredentialsByAgentID(_ context.Context, agentID theauth.ULID) ([]theauth.AgentCredential, error)

func (*Store) AgentsByOwner

func (s *Store) AgentsByOwner(_ context.Context, owner theauth.AgentOwner) ([]theauth.Agent, error)

func (*Store) BackchannelRequestByID

func (s *Store) BackchannelRequestByID(_ context.Context, authReqID string) (theauth.BackchannelRequest, error)

BackchannelRequestByID satisfies CIBAStorage.

func (*Store) ClaimDeviceCode

func (s *Store) ClaimDeviceCode(_ context.Context, hash []byte, now time.Time) (*theauth.DeviceCode, error)

func (*Store) ConfirmTOTPSecret

func (s *Store) ConfirmTOTPSecret(_ context.Context, userID theauth.ULID, at time.Time) error

func (*Store) ConsumeAuthorizationCode

func (s *Store) ConsumeAuthorizationCode(_ context.Context, code string) (*theauth.AuthorizationCode, error)

ConsumeAuthorizationCode is atomic per code: the dedicated authzCodesMu serialises concurrent load-and-delete calls so exactly one caller succeeds per code. Matches the Postgres DELETE ... RETURNING guarantee.

func (*Store) ConsumeDeviceAuthorization added in v2.8.0

func (s *Store) ConsumeDeviceAuthorization(_ context.Context, id theauth.ULID, now time.Time) (bool, error)

ConsumeDeviceAuthorization satisfies DeviceAuthorizationStorage.

func (s *Store) ConsumeMagicLink(_ context.Context, hash []byte) (*theauth.MagicLink, error)

func (*Store) ConsumePasswordResetToken

func (s *Store) ConsumePasswordResetToken(_ context.Context, hash []byte) (*theauth.PasswordResetToken, error)

func (*Store) ConsumePushedRequest

func (s *Store) ConsumePushedRequest(_ context.Context, requestURI string) ([]byte, error)

ConsumePushedRequest implements as.PARStorage: atomically fetches and deletes, returning ErrNotFound when missing or expired.

func (*Store) ConsumeRecoveryCode

func (s *Store) ConsumeRecoveryCode(_ context.Context, userID theauth.ULID, code string, at time.Time) error

ConsumeRecoveryCode walks the user's unused codes and constant-time-checks each against the supplied plaintext. The first hit is marked used and returns nil. No match returns ErrNotFound. Matches the Postgres semantics (linear scan over the per-user slice is fine because N is bounded by RecoveryCodeCount, defaulting to 10).

func (s *Store) ConsumeSessionLink(_ context.Context, tokenHash []byte, now time.Time) (*theauth.SessionLink, error)

ConsumeSessionLink implements theauth.SessionLinkStorage.

func (*Store) CountUnusedRecoveryCodes

func (s *Store) CountUnusedRecoveryCodes(_ context.Context, userID theauth.ULID) (int, error)

CountUnusedRecoveryCodes implements theauth.RecoveryCodeStorage.

func (*Store) CountUsers

func (s *Store) CountUsers(_ context.Context) (int, error)

CountUsers implements theauth.UserCountStorage.

func (*Store) CountUsersWithPermissionInOrg

func (s *Store) CountUsersWithPermissionInOrg(_ context.Context, orgID theauth.ULID, perm string) (int, error)
func (s *Store) CreateMagicLink(_ context.Context, ml theauth.MagicLink) error

func (*Store) CreatePasswordResetToken

func (s *Store) CreatePasswordResetToken(_ context.Context, t theauth.PasswordResetToken) error

func (*Store) CreateSession

func (s *Store) CreateSession(_ context.Context, sess theauth.Session) (theauth.Session, error)
func (s *Store) CreateSessionLink(_ context.Context, l theauth.SessionLink) error

CreateSessionLink implements theauth.SessionLinkStorage.

func (*Store) CreateSessionWithAuthLevel

func (s *Store) CreateSessionWithAuthLevel(_ context.Context, sess theauth.Session) (theauth.Session, error)

CreateSessionWithAuthLevel is identical to CreateSession but honors the AuthLevel field explicitly (defaulting to AuthLevelFull when blank for safety). Service code uses this path when minting a pending_2fa session.

func (*Store) CreateUser

func (s *Store) CreateUser(_ context.Context, u theauth.User) (theauth.User, error)

func (*Store) DecideDeviceAuthorization added in v2.8.0

func (s *Store) DecideDeviceAuthorization(_ context.Context, id theauth.ULID, status string, userID theauth.ULID, now time.Time) (bool, error)

DecideDeviceAuthorization satisfies DeviceAuthorizationStorage.

func (*Store) DecideDeviceCode

func (s *Store) DecideDeviceCode(_ context.Context, userCode string, dec theauth.DeviceDecision, now time.Time) error

func (*Store) DelegationGrantByID

func (s *Store) DelegationGrantByID(_ context.Context, id theauth.ULID) (*theauth.DelegationGrant, error)

func (*Store) DelegationGrantByUserAgentResource

func (s *Store) DelegationGrantByUserAgentResource(_ context.Context, userID, agentID theauth.ULID, resource string) (*theauth.DelegationGrant, error)

func (*Store) DelegationGrantsByAgentID

func (s *Store) DelegationGrantsByAgentID(_ context.Context, agentID theauth.ULID) ([]theauth.DelegationGrant, error)

func (*Store) DelegationGrantsByUserID

func (s *Store) DelegationGrantsByUserID(_ context.Context, userID theauth.ULID) ([]theauth.DelegationGrant, error)

func (*Store) DeleteBackchannelRequest

func (s *Store) DeleteBackchannelRequest(_ context.Context, authReqID string) error

DeleteBackchannelRequest satisfies CIBAStorage.

func (*Store) DeleteExpiredDeviceAuthorizations added in v2.8.0

func (s *Store) DeleteExpiredDeviceAuthorizations(_ context.Context, before time.Time) (int64, error)

DeleteExpiredDeviceAuthorizations satisfies DeviceAuthorizationStorage.

func (*Store) DeleteExpiredDeviceCodes

func (s *Store) DeleteExpiredDeviceCodes(_ context.Context, before time.Time) (int, error)

func (*Store) DeleteGroup

func (s *Store) DeleteGroup(_ context.Context, id theauth.ULID) error

func (*Store) DeleteOAuthAccountByProvider

func (s *Store) DeleteOAuthAccountByProvider(_ context.Context, userID theauth.ULID, provider string) error

DeleteOAuthAccountByProvider removes the row for (userID, provider).

func (*Store) DeleteOAuthClient

func (s *Store) DeleteOAuthClient(_ context.Context, clientID string) error

func (*Store) DeleteOrganization

func (s *Store) DeleteOrganization(_ context.Context, id theauth.ULID) error

func (*Store) DeleteOrganizationMember

func (s *Store) DeleteOrganizationMember(_ context.Context, orgID, userID theauth.ULID) error

func (*Store) DeleteRole

func (s *Store) DeleteRole(_ context.Context, id theauth.ULID) error

func (*Store) DeleteSAMLConnection

func (s *Store) DeleteSAMLConnection(_ context.Context, id theauth.ULID) error

func (*Store) DeleteTOTPSecret

func (s *Store) DeleteTOTPSecret(_ context.Context, userID theauth.ULID) error

func (*Store) DeleteWebAuthnCredential

func (s *Store) DeleteWebAuthnCredential(_ context.Context, id theauth.ULID, userID theauth.ULID) error

func (*Store) DenyAccessToken added in v2.8.0

func (s *Store) DenyAccessToken(_ context.Context, jti string, expiresAt time.Time) error

DenyAccessToken records jti as revoked until expiresAt. Expired entries are purged opportunistically on each call so the map stays bounded by the number of live revoked tokens.

func (*Store) DeviceAuthorizationByDeviceCodeHash added in v2.8.0

func (s *Store) DeviceAuthorizationByDeviceCodeHash(_ context.Context, hash []byte) (*theauth.DeviceAuthorization, error)

DeviceAuthorizationByDeviceCodeHash satisfies DeviceAuthorizationStorage.

func (*Store) DeviceAuthorizationByUserCodeHash added in v2.8.0

func (s *Store) DeviceAuthorizationByUserCodeHash(_ context.Context, hash []byte) (*theauth.DeviceAuthorization, error)

DeviceAuthorizationByUserCodeHash satisfies DeviceAuthorizationStorage. When an expired and a live record share a hash the live one wins.

func (*Store) DeviceCodeByHash

func (s *Store) DeviceCodeByHash(_ context.Context, hash []byte) (*theauth.DeviceCode, error)

func (*Store) DeviceCodeByUserCode

func (s *Store) DeviceCodeByUserCode(_ context.Context, userCode string) (*theauth.DeviceCode, error)

func (*Store) GrantUserRole

func (s *Store) GrantUserRole(_ context.Context, ur theauth.UserRole) error

func (*Store) GroupByExternalIDInOrg

func (s *Store) GroupByExternalIDInOrg(_ context.Context, orgID theauth.ULID, externalID string) (*theauth.Group, error)

func (*Store) GroupByID

func (s *Store) GroupByID(_ context.Context, id theauth.ULID) (*theauth.Group, error)

func (*Store) GroupMembers

func (s *Store) GroupMembers(_ context.Context, groupID theauth.ULID) ([]theauth.ULID, error)

func (*Store) InsertAPIToken

func (s *Store) InsertAPIToken(_ context.Context, t theauth.APIToken) (theauth.APIToken, error)

func (*Store) InsertAgent

func (s *Store) InsertAgent(_ context.Context, a theauth.Agent) (theauth.Agent, error)

func (*Store) InsertAgentCredential

func (s *Store) InsertAgentCredential(_ context.Context, c theauth.AgentCredential) error

func (*Store) InsertAuditEvents

func (s *Store) InsertAuditEvents(_ context.Context, events []theauth.AuditEvent) error

func (*Store) InsertAuthorizationCode

func (s *Store) InsertAuthorizationCode(_ context.Context, c theauth.AuthorizationCode) error

func (*Store) InsertBackchannelRequest

func (s *Store) InsertBackchannelRequest(_ context.Context, req theauth.BackchannelRequest) error

InsertBackchannelRequest satisfies CIBAStorage.

func (*Store) InsertDelegationGrant

func (s *Store) InsertDelegationGrant(_ context.Context, g theauth.DelegationGrant) (theauth.DelegationGrant, error)

func (*Store) InsertDeviceAuthorization added in v2.8.0

func (s *Store) InsertDeviceAuthorization(_ context.Context, in theauth.DeviceAuthorization) error

InsertDeviceAuthorization satisfies DeviceAuthorizationStorage.

func (*Store) InsertDeviceCode

func (s *Store) InsertDeviceCode(_ context.Context, d theauth.DeviceCode) error

func (*Store) InsertGroup

func (s *Store) InsertGroup(_ context.Context, g theauth.Group) (theauth.Group, error)

func (*Store) InsertJTI

func (s *Store) InsertJTI(_ context.Context, jti string, expiresAt time.Time) error

InsertJTI records a new JTI. Returns storage.ErrNotFound when the JTI already exists within its expiry window (reusing the "not found" sentinel as the "duplicate detected" signal per the JWTBearerStorage contract).

func (*Store) InsertJWKSKey

func (s *Store) InsertJWKSKey(_ context.Context, k theauth.JWKSKey) error

func (*Store) InsertOAuthClient

func (s *Store) InsertOAuthClient(_ context.Context, c theauth.OAuthClient) (theauth.OAuthClient, error)

func (*Store) InsertOpaqueAccessToken added in v2.8.0

func (s *Store) InsertOpaqueAccessToken(_ context.Context, t theauth.OpaqueAccessToken) error

InsertOpaqueAccessToken satisfies OpaqueTokenStorage.

func (*Store) InsertOrganization

func (s *Store) InsertOrganization(_ context.Context, o theauth.Organization) (theauth.Organization, error)

func (*Store) InsertPermission

func (s *Store) InsertPermission(_ context.Context, p theauth.Permission) (theauth.Permission, error)

func (*Store) InsertPushedRequest

func (s *Store) InsertPushedRequest(_ context.Context, requestURI string, payload []byte, expiresAt time.Time) error

InsertPushedRequest implements as.PARStorage.

func (*Store) InsertRecoveryCodes

func (s *Store) InsertRecoveryCodes(_ context.Context, codes []theauth.RecoveryCode) error

func (*Store) InsertRefreshToken

func (s *Store) InsertRefreshToken(_ context.Context, t theauth.RefreshToken) error

func (*Store) InsertRegistrationToken added in v2.8.0

func (s *Store) InsertRegistrationToken(_ context.Context, t theauth.RegistrationToken) error

InsertRegistrationToken satisfies RegistrationTokenStorage.

func (*Store) InsertRole

func (s *Store) InsertRole(_ context.Context, r theauth.Role) (theauth.Role, error)

func (*Store) InsertSAMLConnection

func (s *Store) InsertSAMLConnection(_ context.Context, c theauth.SAMLConnection) (theauth.SAMLConnection, error)

func (*Store) InsertSCIMToken

func (s *Store) InsertSCIMToken(_ context.Context, t theauth.SCIMToken) (theauth.SCIMToken, error)

func (*Store) InsertWebAuthnCredential

func (s *Store) InsertWebAuthnCredential(_ context.Context, c theauth.WebAuthnCredential) (theauth.WebAuthnCredential, error)

func (*Store) IsAccessTokenDenied added in v2.8.0

func (s *Store) IsAccessTokenDenied(_ context.Context, jti string) (bool, error)

IsAccessTokenDenied reports whether jti is on the denylist and unexpired.

func (*Store) JWKSKeyByKID

func (s *Store) JWKSKeyByKID(_ context.Context, kid string) (*theauth.JWKSKey, error)

func (*Store) JWKSKeysAll

func (s *Store) JWKSKeysAll(_ context.Context) ([]theauth.JWKSKey, error)

func (*Store) ListAPITokens

func (s *Store) ListAPITokens(_ context.Context) ([]theauth.APIToken, error)

func (*Store) ListGroupsByOrganization

func (s *Store) ListGroupsByOrganization(_ context.Context, orgID theauth.ULID, offset, limit int, filter theauth.SCIMGroupFilter) ([]theauth.Group, int, error)

func (*Store) ListPendingDeviceCodes

func (s *Store) ListPendingDeviceCodes(_ context.Context, f theauth.DevicePendingFilter) ([]theauth.DeviceCode, error)

ListPendingDeviceCodes returns pending, unexpired requests newest first without device code hashes.

func (*Store) ListPermissions

func (s *Store) ListPermissions(_ context.Context) ([]theauth.Permission, error)

func (*Store) ListRegistrationTokens added in v2.8.0

func (s *Store) ListRegistrationTokens(_ context.Context, orgID *theauth.ULID) ([]theauth.RegistrationToken, error)

ListRegistrationTokens satisfies RegistrationTokenStorage.

func (*Store) ListUserSessions

func (s *Store) ListUserSessions(_ context.Context, userID theauth.ULID) ([]theauth.Session, error)

ListUserSessions implements theauth.SessionManagementStorage.

func (*Store) ListUsersByOrganization

func (s *Store) ListUsersByOrganization(_ context.Context, orgID theauth.ULID, offset, limit int, filter theauth.SCIMUserFilter) ([]theauth.User, int, error)

func (*Store) MarkEmailVerified

func (s *Store) MarkEmailVerified(_ context.Context, userID theauth.ULID) error

func (*Store) MoveOAuthAccount

func (s *Store) MoveOAuthAccount(_ context.Context, provider, providerUserID string, newUserID theauth.ULID) error

MoveOAuthAccount reassigns a row identified by (provider, providerUserID) to newUserID.

func (*Store) MovePasswordHash

func (s *Store) MovePasswordHash(_ context.Context, primaryID, secondaryID theauth.ULID) error

MovePasswordHash copies the Argon2id hash from secondaryID to primaryID (overwriting any existing primary hash) then clears secondaryID's hash.

func (*Store) MoveTOTPSecret

func (s *Store) MoveTOTPSecret(_ context.Context, primaryID, secondaryID theauth.ULID) error

MoveTOTPSecret reassigns the TOTP secret from secondaryID to primaryID. If primaryID already has a confirmed TOTP secret, the secondary secret is dropped to avoid clobbering an active factor.

func (*Store) MoveWebAuthnCredentials

func (s *Store) MoveWebAuthnCredentials(_ context.Context, primaryID, secondaryID theauth.ULID) error

MoveWebAuthnCredentials reassigns every WebAuthn credential from secondaryID to primaryID.

func (*Store) OAuthAccountByProviderUserID

func (s *Store) OAuthAccountByProviderUserID(_ context.Context, provider, providerUserID string) (*theauth.OAuthAccount, error)

func (*Store) OAuthAccountsByUserID

func (s *Store) OAuthAccountsByUserID(_ context.Context, userID theauth.ULID) ([]theauth.OAuthAccount, error)

OAuthAccountsByUserID returns every OAuth account row linked to userID.

func (*Store) OAuthClientByClientID

func (s *Store) OAuthClientByClientID(_ context.Context, clientID string) (*theauth.OAuthClient, error)

func (*Store) OpaqueAccessTokenByHash added in v2.8.0

func (s *Store) OpaqueAccessTokenByHash(_ context.Context, hash []byte) (*theauth.OpaqueAccessToken, error)

OpaqueAccessTokenByHash satisfies OpaqueTokenStorage.

func (*Store) OrganizationByID

func (s *Store) OrganizationByID(_ context.Context, id theauth.ULID) (*theauth.Organization, error)

func (*Store) OrganizationBySlug

func (s *Store) OrganizationBySlug(_ context.Context, slug string) (*theauth.Organization, error)

func (*Store) OrganizationMemberRole

func (s *Store) OrganizationMemberRole(_ context.Context, orgID, userID theauth.ULID) (string, error)

func (*Store) OrganizationMembersByOrg

func (s *Store) OrganizationMembersByOrg(_ context.Context, orgID theauth.ULID) ([]theauth.OrganizationMember, error)

func (*Store) OrganizationsByUser

func (s *Store) OrganizationsByUser(_ context.Context, userID theauth.ULID) ([]theauth.Organization, error)

func (*Store) PermissionByName

func (s *Store) PermissionByName(_ context.Context, name string) (*theauth.Permission, error)

func (*Store) PermissionsByRole

func (s *Store) PermissionsByRole(_ context.Context, roleID theauth.ULID) ([]string, error)

func (*Store) PermissionsForUser

func (s *Store) PermissionsForUser(_ context.Context, userID theauth.ULID, orgID *theauth.ULID) ([]string, error)

func (*Store) QueryAuditEvents

func (s *Store) QueryAuditEvents(_ context.Context, q theauth.AuditQuery) ([]theauth.AuditEvent, string, error)

func (*Store) RecordDeviceAuthorizationPoll added in v2.8.0

func (s *Store) RecordDeviceAuthorizationPoll(_ context.Context, id theauth.ULID, polledAt time.Time, intervalSeconds int) error

RecordDeviceAuthorizationPoll satisfies DeviceAuthorizationStorage.

func (*Store) RecordDevicePoll

func (s *Store) RecordDevicePoll(_ context.Context, hash []byte, at time.Time, intervalSeconds int) error

func (*Store) RedeemRegistrationToken added in v2.8.0

func (s *Store) RedeemRegistrationToken(_ context.Context, id theauth.ULID, now time.Time) (bool, error)

RedeemRegistrationToken satisfies RegistrationTokenStorage.

func (*Store) RefreshTokenByHash

func (s *Store) RefreshTokenByHash(_ context.Context, hash []byte) (*theauth.RefreshToken, error)

func (*Store) RefundRegistrationToken added in v2.8.0

func (s *Store) RefundRegistrationToken(_ context.Context, id theauth.ULID) error

RefundRegistrationToken satisfies RegistrationTokenStorage.

func (*Store) RegistrationTokenByHash added in v2.8.0

func (s *Store) RegistrationTokenByHash(_ context.Context, hash []byte) (*theauth.RegistrationToken, error)

RegistrationTokenByHash satisfies RegistrationTokenStorage.

func (*Store) RegistrationTokenByID added in v2.8.0

func (s *Store) RegistrationTokenByID(_ context.Context, id theauth.ULID) (*theauth.RegistrationToken, error)

RegistrationTokenByID satisfies RegistrationTokenStorage.

func (*Store) RemoveGroupMembers

func (s *Store) RemoveGroupMembers(_ context.Context, groupID theauth.ULID, userIDs []theauth.ULID) error

func (*Store) RenameWebAuthnCredential

func (s *Store) RenameWebAuthnCredential(_ context.Context, id, userID theauth.ULID, name string) error

RenameWebAuthnCredential implements theauth.WebAuthnRenameStorage.

func (*Store) ReplaceRecoveryCodes

func (s *Store) ReplaceRecoveryCodes(_ context.Context, userID theauth.ULID, codes []theauth.RecoveryCode) error

ReplaceRecoveryCodes implements theauth.RecoveryCodeStorage.

func (*Store) RevokeAPIToken

func (s *Store) RevokeAPIToken(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) RevokeAPITokensByOwner

func (s *Store) RevokeAPITokensByOwner(_ context.Context, ownerID theauth.ULID, at time.Time) (int, error)

func (*Store) RevokeAgentCredential

func (s *Store) RevokeAgentCredential(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) RevokeDelegationGrant

func (s *Store) RevokeDelegationGrant(_ context.Context, id theauth.ULID, at time.Time, reason string) error

func (*Store) RevokeOpaqueAccessToken added in v2.8.0

func (s *Store) RevokeOpaqueAccessToken(_ context.Context, hash []byte) error

RevokeOpaqueAccessToken satisfies OpaqueTokenStorage.

func (*Store) RevokeOtherUserSessions

func (s *Store) RevokeOtherUserSessions(_ context.Context, userID, keep theauth.ULID) (int, error)

RevokeOtherUserSessions implements theauth.SessionManagementStorage.

func (*Store) RevokeRefreshToken

func (s *Store) RevokeRefreshToken(_ context.Context, hash []byte, reason string) error

func (*Store) RevokeRefreshTokenFamily

func (s *Store) RevokeRefreshTokenFamily(_ context.Context, familyID theauth.ULID, reason string) error

func (*Store) RevokeRefreshTokensByAuthCode added in v2.8.0

func (s *Store) RevokeRefreshTokensByAuthCode(_ context.Context, codeHash, reason string) ([]string, error)

RevokeRefreshTokensByAuthCode revokes every live token in the rotation families first issued from the authorization code stored under codeHash and returns the access-token jtis (ParentJTI) of the tokens it revoked.

func (*Store) RevokeRegistrationToken added in v2.8.0

func (s *Store) RevokeRegistrationToken(_ context.Context, id theauth.ULID, at time.Time) (bool, error)

RevokeRegistrationToken satisfies RegistrationTokenStorage.

func (*Store) RevokeSCIMTokenByID

func (s *Store) RevokeSCIMTokenByID(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) RevokeSession

func (s *Store) RevokeSession(_ context.Context, id theauth.ULID) error

func (*Store) RevokeSessionsByCredential

func (s *Store) RevokeSessionsByCredential(_ context.Context, credentialID string) (int, error)

RevokeSessionsByCredential implements theauth.SessionManagementStorage.

func (*Store) RevokeUserRole

func (s *Store) RevokeUserRole(_ context.Context, userID, roleID theauth.ULID) error

func (*Store) RevokeUserSessions

func (s *Store) RevokeUserSessions(_ context.Context, userID theauth.ULID) error

func (*Store) RoleByID

func (s *Store) RoleByID(_ context.Context, id theauth.ULID) (*theauth.Role, error)

func (*Store) RoleByOrgAndName

func (s *Store) RoleByOrgAndName(_ context.Context, orgID *theauth.ULID, name string) (*theauth.Role, error)

func (*Store) RolesByOrganization

func (s *Store) RolesByOrganization(_ context.Context, orgID *theauth.ULID) ([]theauth.Role, error)

func (*Store) RolesForUser

func (s *Store) RolesForUser(_ context.Context, userID theauth.ULID, orgID *theauth.ULID) ([]theauth.Role, error)

func (*Store) SAMLConnectionByID

func (s *Store) SAMLConnectionByID(_ context.Context, id theauth.ULID) (*theauth.SAMLConnection, error)

func (*Store) SAMLConnectionsByOrg

func (s *Store) SAMLConnectionsByOrg(_ context.Context, orgID theauth.ULID) ([]theauth.SAMLConnection, error)

func (*Store) SAMLIdentityByConnectionAndNameID

func (s *Store) SAMLIdentityByConnectionAndNameID(_ context.Context, connectionID theauth.ULID, nameID string) (*theauth.SAMLIdentity, error)

func (*Store) SCIMTokenByHash

func (s *Store) SCIMTokenByHash(_ context.Context, hash []byte) (*theauth.SCIMToken, error)

func (*Store) SCIMTokensByOrg

func (s *Store) SCIMTokensByOrg(_ context.Context, orgID theauth.ULID) ([]theauth.SCIMToken, error)

func (*Store) SessionByID

func (s *Store) SessionByID(_ context.Context, id theauth.ULID) (*theauth.Session, error)

func (*Store) SessionByTokenHash

func (s *Store) SessionByTokenHash(_ context.Context, hash []byte) (*theauth.Session, error)

func (*Store) SetGroupMembers

func (s *Store) SetGroupMembers(_ context.Context, groupID theauth.ULID, userIDs []theauth.ULID) error

func (*Store) SetRolePermissions

func (s *Store) SetRolePermissions(_ context.Context, roleID theauth.ULID, permissionIDs []theauth.ULID) error

func (*Store) SetSessionActiveOrganization

func (s *Store) SetSessionActiveOrganization(_ context.Context, sessionID theauth.ULID, orgID *theauth.ULID) error

func (*Store) SetSessionElevatedUntil

func (s *Store) SetSessionElevatedUntil(_ context.Context, id theauth.ULID, until *time.Time) error

SetSessionElevatedUntil implements theauth.SessionManagementStorage.

func (*Store) SetUserPassword

func (s *Store) SetUserPassword(_ context.Context, userID theauth.ULID, passwordHash string) error

func (*Store) SweepExpiredJTIs

func (s *Store) SweepExpiredJTIs(_ context.Context, before time.Time) error

SweepExpiredJTIs removes all entries whose expiresAt is before the supplied time.

func (*Store) TOTPSecretByUserID

func (s *Store) TOTPSecretByUserID(_ context.Context, userID theauth.ULID) (*theauth.TOTPSecret, error)

func (*Store) TouchAPITokenLastUsed

func (s *Store) TouchAPITokenLastUsed(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) TouchBackchannelPoll

func (s *Store) TouchBackchannelPoll(_ context.Context, authReqID string, now time.Time, newInterval int) (theauth.BackchannelRequest, error)

TouchBackchannelPoll satisfies CIBAStorage. It updates LastPollAt and PollInterval atomically and returns the updated row.

func (*Store) TouchSAMLIdentityLastLogin

func (s *Store) TouchSAMLIdentityLastLogin(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) TouchSCIMTokenLastUsed

func (s *Store) TouchSCIMTokenLastUsed(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) TouchSession

func (s *Store) TouchSession(_ context.Context, id theauth.ULID, at time.Time) error

TouchSession implements theauth.SessionManagementStorage.

func (*Store) UpdateAgentCredentialLastUsed

func (s *Store) UpdateAgentCredentialLastUsed(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) UpdateAgentLastActive

func (s *Store) UpdateAgentLastActive(_ context.Context, id theauth.ULID, at time.Time) error

func (*Store) UpdateAgentStatus

func (s *Store) UpdateAgentStatus(_ context.Context, id theauth.ULID, status string, _ time.Time) error

func (*Store) UpdateBackchannelRequest

func (s *Store) UpdateBackchannelRequest(_ context.Context, req theauth.BackchannelRequest) error

UpdateBackchannelRequest satisfies CIBAStorage.

func (*Store) UpdateGroup

func (s *Store) UpdateGroup(_ context.Context, g theauth.Group) error

func (*Store) UpdateJWKSKeyState

func (s *Store) UpdateJWKSKeyState(_ context.Context, kid, state string, at time.Time) error

func (*Store) UpdateOAuthClient

func (s *Store) UpdateOAuthClient(_ context.Context, c theauth.OAuthClient) (theauth.OAuthClient, error)

func (*Store) UpdateOrganization

func (s *Store) UpdateOrganization(_ context.Context, o theauth.Organization) error

func (*Store) UpdateRoleRow

func (s *Store) UpdateRoleRow(_ context.Context, r theauth.Role) (theauth.Role, error)

func (*Store) UpdateSAMLConnectionRow

func (s *Store) UpdateSAMLConnectionRow(_ context.Context, c theauth.SAMLConnection) error

func (*Store) UpdateSessionAuthLevel

func (s *Store) UpdateSessionAuthLevel(_ context.Context, id theauth.ULID, level string) error

UpdateSessionAuthLevel rewrites the AuthLevel column on the named session. Used to promote pending_2fa to full after a successful TOTP verify.

func (*Store) UpdateUserSCIM

func (s *Store) UpdateUserSCIM(_ context.Context, u theauth.User) error

func (*Store) UpdateWebAuthnBackupFlags

func (s *Store) UpdateWebAuthnBackupFlags(_ context.Context, credentialID []byte, backupEligible, backupState bool) error

UpdateWebAuthnBackupFlags records the BE / BS flags for a stored credential (trust-on-first-use reconciliation for legacy synced passkeys). A missing credential is a no-op returning nil, mirroring the Postgres adapter: the caller treats reconciliation as best-effort.

func (*Store) UpdateWebAuthnSignCount

func (s *Store) UpdateWebAuthnSignCount(_ context.Context, credentialID []byte, newCount uint32, usedAt time.Time) error

func (*Store) UpsertOAuthAccount

func (s *Store) UpsertOAuthAccount(_ context.Context, a theauth.OAuthAccount) (theauth.OAuthAccount, error)

UpsertOAuthAccount mirrors the Postgres ON CONFLICT (provider, provider_user_id) DO UPDATE behavior: if a row with the same (provider, provider_user_id) already exists, its mutable fields are refreshed in place (keeping the original ID + CreatedAt). Otherwise the supplied row is inserted as-is.

func (*Store) UpsertOrganizationMember

func (s *Store) UpsertOrganizationMember(_ context.Context, m theauth.OrganizationMember) error

func (*Store) UpsertPendingTOTPSecret

func (s *Store) UpsertPendingTOTPSecret(_ context.Context, sec theauth.TOTPSecret) error

func (*Store) UpsertSAMLIdentity

func (s *Store) UpsertSAMLIdentity(_ context.Context, i theauth.SAMLIdentity) (theauth.SAMLIdentity, error)

func (*Store) UserByEmail

func (s *Store) UserByEmail(_ context.Context, email string) (*theauth.User, error)

func (*Store) UserByEmailWithPassword

func (s *Store) UserByEmailWithPassword(_ context.Context, email string) (*theauth.User, string, error)

func (*Store) UserByExternalIDInOrg

func (s *Store) UserByExternalIDInOrg(_ context.Context, orgID theauth.ULID, externalID string) (*theauth.User, error)

func (*Store) UserByID

func (s *Store) UserByID(_ context.Context, id theauth.ULID) (*theauth.User, error)

func (*Store) UserPasswordHashByID

func (s *Store) UserPasswordHashByID(_ context.Context, userID theauth.ULID) (string, error)

UserPasswordHashByID returns the stored Argon2id PHC string, or "" when the user has no password set.

func (*Store) WebAuthnCredentialByCredentialID

func (s *Store) WebAuthnCredentialByCredentialID(_ context.Context, credentialID []byte) (*theauth.WebAuthnCredential, error)

func (*Store) WebAuthnCredentialsByUserID

func (s *Store) WebAuthnCredentialsByUserID(_ context.Context, userID theauth.ULID) ([]theauth.WebAuthnCredential, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL