storage

package
v4.37.3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrFmtMigrateUpTargetLessThanCurrent      = "schema up migration target version %d is less then the current version %d"
	ErrFmtMigrateUpTargetGreaterThanLatest    = "schema up migration target version %d is greater then the latest version %d which indicates it doesn't exist"
	ErrFmtMigrateDownTargetGreaterThanCurrent = "schema down migration target version %d is greater than the current version %d"
	ErrFmtMigrateDownTargetLessThanMinimum    = "schema down migration target version %d is less than the minimum version"
	ErrFmtMigrateAlreadyOnTargetVersion       = "schema migration target version %d is the same current version %d"
)

Error formats for the storage provider.

View Source
const (
	// SchemaLatest represents the value expected for a "migrate to latest" migration. It's the maximum 32bit signed integer.
	SchemaLatest = 2147483647
)

Variables

View Source
var (
	// ErrNoAuthenticationLogs error thrown when no matching authentication logs hve been found in DB.
	ErrNoAuthenticationLogs = errors.New("no matching authentication logs found")

	// ErrNoTOTPConfiguration error thrown when no TOTP configuration has been found in DB.
	ErrNoTOTPConfiguration = errors.New("no TOTP configuration for user")

	// ErrNoWebauthnDevice error thrown when no Webauthn device handle has been found in DB.
	ErrNoWebauthnDevice = errors.New("no Webauthn device found")

	// ErrNoDuoDevice error thrown when no Duo device and method has been found in DB.
	ErrNoDuoDevice = errors.New("no Duo device and method saved")

	// ErrNoAvailableMigrations is returned when no available migrations can be found.
	ErrNoAvailableMigrations = errors.New("no available migrations")

	// ErrMigrateCurrentVersionSameAsTarget is returned when the target version is the same as the current.
	ErrMigrateCurrentVersionSameAsTarget = errors.New("current version is same as migration target, no action being taken")

	// ErrSchemaAlreadyUpToDate is returned when the schema is already up to date.
	ErrSchemaAlreadyUpToDate = errors.New("schema already up to date")

	// ErrNoMigrationsFound is returned when no migrations were found.
	ErrNoMigrationsFound = errors.New("no schema migrations found")

	// ErrSchemaEncryptionVersionUnsupported is returned when the schema is checked if the encryption key is valid for
	// the database but the schema doesn't support encryption.
	ErrSchemaEncryptionVersionUnsupported = errors.New("schema version doesn't support encryption")

	// ErrSchemaEncryptionInvalidKey is returned when the schema is checked if the encryption key is valid for
	// the database but the key doesn't appear to be valid.
	ErrSchemaEncryptionInvalidKey = errors.New("the configured encryption key does not appear to be valid for this database which may occur if the encryption key was changed in the configuration without using the cli to change it in the database")
)

Functions

func SchemaVersionToString added in v4.33.0

func SchemaVersionToString(version int) (versionStr string)

SchemaVersionToString returns a version string given a version number.

Types

type ConsentPreConfigRows added in v4.37.0

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

ConsentPreConfigRows holds and assists with retrieving multiple model.OAuth2ConsentSession rows.

func (*ConsentPreConfigRows) Close added in v4.37.0

func (r *ConsentPreConfigRows) Close() (err error)

Close the rows.

func (*ConsentPreConfigRows) Get added in v4.37.0

func (r *ConsentPreConfigRows) Get() (config *model.OAuth2ConsentPreConfig, err error)

Get returns the *model.OAuth2ConsentSession or scan error.

func (*ConsentPreConfigRows) Next added in v4.37.0

func (r *ConsentPreConfigRows) Next() bool

Next is the row iterator.

type EncryptionChangeKeyFunc added in v4.37.3

type EncryptionChangeKeyFunc func(ctx context.Context, provider *SQLProvider, tx *sqlx.Tx, key [32]byte) (err error)

EncryptionChangeKeyFunc handles encryption key changes for a specific table or tables.

type EncryptionCheckKeyFunc added in v4.37.3

type EncryptionCheckKeyFunc func(ctx context.Context, provider *SQLProvider) (table string, result EncryptionValidationTableResult)

EncryptionCheckKeyFunc handles encryption key checking for a specific table or tables.

type EncryptionValidationResult added in v4.37.3

type EncryptionValidationResult struct {
	InvalidCheckValue bool
	Tables            map[string]EncryptionValidationTableResult
}

EncryptionValidationResult contains information about the success of a schema encryption validation.

func (EncryptionValidationResult) Checked added in v4.37.3

func (r EncryptionValidationResult) Checked() bool

Checked returns true the validation completed all phases even if there were errors.

func (EncryptionValidationResult) Success added in v4.37.3

func (r EncryptionValidationResult) Success() bool

Success returns true if no validation errors occurred.

type EncryptionValidationTableResult added in v4.37.3

type EncryptionValidationTableResult struct {
	Error   error
	Total   int
	Invalid int
}

EncryptionValidationTableResult contains information about the success of a table schema encryption validation.

func (EncryptionValidationTableResult) ResultDescriptor added in v4.37.3

func (r EncryptionValidationTableResult) ResultDescriptor() string

ResultDescriptor returns a string representing the result.

type MySQLProvider

type MySQLProvider struct {
	SQLProvider
}

MySQLProvider is a MySQL provider.

func NewMySQLProvider

func NewMySQLProvider(config *schema.Configuration, caCertPool *x509.CertPool) (provider *MySQLProvider)

NewMySQLProvider a MySQL provider.

type OAuth2SessionType added in v4.35.0

type OAuth2SessionType int

OAuth2SessionType represents the potential OAuth 2.0 session types.

const (
	OAuth2SessionTypeAuthorizeCode OAuth2SessionType = iota
	OAuth2SessionTypeAccessToken
	OAuth2SessionTypeRefreshToken
	OAuth2SessionTypePKCEChallenge
	OAuth2SessionTypeOpenIDConnect
)

Representation of specific OAuth 2.0 session types.

func (OAuth2SessionType) String added in v4.37.3

func (s OAuth2SessionType) String() string

String returns a string representation of this OAuth2SessionType.

func (OAuth2SessionType) Table added in v4.37.3

func (s OAuth2SessionType) Table() string

Table returns the table name for this session type.

type PostgreSQLProvider

type PostgreSQLProvider struct {
	SQLProvider
}

PostgreSQLProvider is a PostgreSQL provider.

func NewPostgreSQLProvider

func NewPostgreSQLProvider(config *schema.Configuration, caCertPool *x509.CertPool) (provider *PostgreSQLProvider)

NewPostgreSQLProvider a PostgreSQL provider.

type Provider

type Provider interface {
	model.StartupCheck

	RegulatorProvider

	storage.Transactional

	SavePreferred2FAMethod(ctx context.Context, username string, method string) (err error)
	LoadPreferred2FAMethod(ctx context.Context, username string) (method string, err error)
	LoadUserInfo(ctx context.Context, username string) (info model.UserInfo, err error)

	SaveUserOpaqueIdentifier(ctx context.Context, subject model.UserOpaqueIdentifier) (err error)
	LoadUserOpaqueIdentifier(ctx context.Context, opaqueUUID uuid.UUID) (subject *model.UserOpaqueIdentifier, err error)
	LoadUserOpaqueIdentifiers(ctx context.Context) (opaqueIDs []model.UserOpaqueIdentifier, err error)
	LoadUserOpaqueIdentifierBySignature(ctx context.Context, service, sectorID, username string) (subject *model.UserOpaqueIdentifier, err error)

	SaveIdentityVerification(ctx context.Context, verification model.IdentityVerification) (err error)
	ConsumeIdentityVerification(ctx context.Context, jti string, ip model.NullIP) (err error)
	FindIdentityVerification(ctx context.Context, jti string) (found bool, err error)

	SaveTOTPConfiguration(ctx context.Context, config model.TOTPConfiguration) (err error)
	UpdateTOTPConfigurationSignIn(ctx context.Context, id int, lastUsedAt sql.NullTime) (err error)
	DeleteTOTPConfiguration(ctx context.Context, username string) (err error)
	LoadTOTPConfiguration(ctx context.Context, username string) (config *model.TOTPConfiguration, err error)
	LoadTOTPConfigurations(ctx context.Context, limit, page int) (configs []model.TOTPConfiguration, err error)

	SaveWebauthnDevice(ctx context.Context, device model.WebauthnDevice) (err error)
	UpdateWebauthnDeviceSignIn(ctx context.Context, id int, rpid string, lastUsedAt sql.NullTime, signCount uint32, cloneWarning bool) (err error)
	DeleteWebauthnDevice(ctx context.Context, kid string) (err error)
	DeleteWebauthnDeviceByUsername(ctx context.Context, username, description string) (err error)
	LoadWebauthnDevices(ctx context.Context, limit, page int) (devices []model.WebauthnDevice, err error)
	LoadWebauthnDevicesByUsername(ctx context.Context, username string) (devices []model.WebauthnDevice, err error)

	SavePreferredDuoDevice(ctx context.Context, device model.DuoDevice) (err error)
	DeletePreferredDuoDevice(ctx context.Context, username string) (err error)
	LoadPreferredDuoDevice(ctx context.Context, username string) (device *model.DuoDevice, err error)

	SaveOAuth2ConsentPreConfiguration(ctx context.Context, config model.OAuth2ConsentPreConfig) (insertedID int64, err error)
	LoadOAuth2ConsentPreConfigurations(ctx context.Context, clientID string, subject uuid.UUID) (rows *ConsentPreConfigRows, err error)

	SaveOAuth2ConsentSession(ctx context.Context, consent model.OAuth2ConsentSession) (err error)
	SaveOAuth2ConsentSessionSubject(ctx context.Context, consent model.OAuth2ConsentSession) (err error)
	SaveOAuth2ConsentSessionResponse(ctx context.Context, consent model.OAuth2ConsentSession, rejection bool) (err error)
	SaveOAuth2ConsentSessionGranted(ctx context.Context, id int) (err error)
	LoadOAuth2ConsentSessionByChallengeID(ctx context.Context, challengeID uuid.UUID) (consent *model.OAuth2ConsentSession, err error)

	SaveOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, session model.OAuth2Session) (err error)
	RevokeOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, signature string) (err error)
	RevokeOAuth2SessionByRequestID(ctx context.Context, sessionType OAuth2SessionType, requestID string) (err error)
	DeactivateOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, signature string) (err error)
	DeactivateOAuth2SessionByRequestID(ctx context.Context, sessionType OAuth2SessionType, requestID string) (err error)
	LoadOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, signature string) (session *model.OAuth2Session, err error)

	SaveOAuth2BlacklistedJTI(ctx context.Context, blacklistedJTI model.OAuth2BlacklistedJTI) (err error)
	LoadOAuth2BlacklistedJTI(ctx context.Context, signature string) (blacklistedJTI *model.OAuth2BlacklistedJTI, err error)

	SchemaTables(ctx context.Context) (tables []string, err error)
	SchemaVersion(ctx context.Context) (version int, err error)
	SchemaLatestVersion() (version int, err error)

	SchemaMigrate(ctx context.Context, up bool, version int) (err error)
	SchemaMigrationHistory(ctx context.Context) (migrations []model.Migration, err error)
	SchemaMigrationsUp(ctx context.Context, version int) (migrations []model.SchemaMigration, err error)
	SchemaMigrationsDown(ctx context.Context, version int) (migrations []model.SchemaMigration, err error)

	SchemaEncryptionChangeKey(ctx context.Context, key string) (err error)
	SchemaEncryptionCheckKey(ctx context.Context, verbose bool) (result EncryptionValidationResult, err error)

	Close() (err error)
}

Provider is an interface providing storage capabilities for persisting any kind of data related to Authelia.

type RegulatorProvider added in v4.33.0

type RegulatorProvider interface {
	AppendAuthenticationLog(ctx context.Context, attempt model.AuthenticationAttempt) (err error)
	LoadAuthenticationLogs(ctx context.Context, username string, fromDate time.Time, limit, page int) (attempts []model.AuthenticationAttempt, err error)
}

RegulatorProvider is an interface providing storage capabilities for persisting any kind of data related to the regulator.

type SQLProvider

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

SQLProvider is a storage provider persisting data in a SQL database.

func NewSQLProvider added in v4.33.0

func NewSQLProvider(config *schema.Configuration, name, driverName, dataSourceName string) (provider SQLProvider)

NewSQLProvider generates a generic SQLProvider to be used with other SQL provider NewUp's.

func (*SQLProvider) AppendAuthenticationLog

func (p *SQLProvider) AppendAuthenticationLog(ctx context.Context, attempt model.AuthenticationAttempt) (err error)

AppendAuthenticationLog append a mark to the authentication log.

func (*SQLProvider) BeginTX added in v4.35.0

func (p *SQLProvider) BeginTX(ctx context.Context) (c context.Context, err error)

BeginTX begins a transaction.

func (*SQLProvider) Close added in v4.33.0

func (p *SQLProvider) Close() (err error)

Close the underlying database connection.

func (*SQLProvider) Commit added in v4.35.0

func (p *SQLProvider) Commit(ctx context.Context) (err error)

Commit performs a database commit.

func (*SQLProvider) ConsumeIdentityVerification added in v4.33.0

func (p *SQLProvider) ConsumeIdentityVerification(ctx context.Context, jti string, ip model.NullIP) (err error)

ConsumeIdentityVerification marks an identity verification record in the database as consumed.

func (*SQLProvider) DeactivateOAuth2Session added in v4.35.0

func (p *SQLProvider) DeactivateOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, signature string) (err error)

DeactivateOAuth2Session marks a OAuth2Session as inactive in the database.

func (*SQLProvider) DeactivateOAuth2SessionByRequestID added in v4.35.0

func (p *SQLProvider) DeactivateOAuth2SessionByRequestID(ctx context.Context, sessionType OAuth2SessionType, requestID string) (err error)

DeactivateOAuth2SessionByRequestID marks a OAuth2Session as inactive in the database.

func (*SQLProvider) DeletePreferredDuoDevice added in v4.33.0

func (p *SQLProvider) DeletePreferredDuoDevice(ctx context.Context, username string) (err error)

DeletePreferredDuoDevice deletes a Duo device of a given user.

func (*SQLProvider) DeleteTOTPConfiguration added in v4.33.0

func (p *SQLProvider) DeleteTOTPConfiguration(ctx context.Context, username string) (err error)

DeleteTOTPConfiguration delete a TOTP configuration from the database given a username.

func (*SQLProvider) DeleteWebauthnDevice added in v4.37.0

func (p *SQLProvider) DeleteWebauthnDevice(ctx context.Context, kid string) (err error)

DeleteWebauthnDevice deletes a registered Webauthn device.

func (*SQLProvider) DeleteWebauthnDeviceByUsername added in v4.37.0

func (p *SQLProvider) DeleteWebauthnDeviceByUsername(ctx context.Context, username, description string) (err error)

DeleteWebauthnDeviceByUsername deletes registered Webauthn devices by username or username and description.

func (*SQLProvider) FindIdentityVerification added in v4.33.0

func (p *SQLProvider) FindIdentityVerification(ctx context.Context, jti string) (found bool, err error)

FindIdentityVerification checks if an identity verification record is in the database and active.

func (*SQLProvider) LoadAuthenticationLogs added in v4.33.0

func (p *SQLProvider) LoadAuthenticationLogs(ctx context.Context, username string, fromDate time.Time, limit, page int) (attempts []model.AuthenticationAttempt, err error)

LoadAuthenticationLogs retrieve the latest failed authentications from the authentication log.

func (*SQLProvider) LoadOAuth2BlacklistedJTI added in v4.35.0

func (p *SQLProvider) LoadOAuth2BlacklistedJTI(ctx context.Context, signature string) (blacklistedJTI *model.OAuth2BlacklistedJTI, err error)

LoadOAuth2BlacklistedJTI loads a OAuth2BlacklistedJTI from the database.

func (*SQLProvider) LoadOAuth2ConsentPreConfigurations added in v4.37.0

func (p *SQLProvider) LoadOAuth2ConsentPreConfigurations(ctx context.Context, clientID string, subject uuid.UUID) (rows *ConsentPreConfigRows, err error)

LoadOAuth2ConsentPreConfigurations returns an OAuth2.0 consents pre-configurations given the consent signature.

func (*SQLProvider) LoadOAuth2ConsentSessionByChallengeID added in v4.35.0

func (p *SQLProvider) LoadOAuth2ConsentSessionByChallengeID(ctx context.Context, challengeID uuid.UUID) (consent *model.OAuth2ConsentSession, err error)

LoadOAuth2ConsentSessionByChallengeID returns an OAuth2.0 consent given the challenge ID.

func (*SQLProvider) LoadOAuth2Session added in v4.35.0

func (p *SQLProvider) LoadOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, signature string) (session *model.OAuth2Session, err error)

LoadOAuth2Session saves a OAuth2Session from the database.

func (*SQLProvider) LoadPreferred2FAMethod

func (p *SQLProvider) LoadPreferred2FAMethod(ctx context.Context, username string) (method string, err error)

LoadPreferred2FAMethod load the preferred method for 2FA from the database.

func (*SQLProvider) LoadPreferredDuoDevice added in v4.33.0

func (p *SQLProvider) LoadPreferredDuoDevice(ctx context.Context, username string) (device *model.DuoDevice, err error)

LoadPreferredDuoDevice loads a Duo device of a given user.

func (*SQLProvider) LoadTOTPConfiguration added in v4.33.0

func (p *SQLProvider) LoadTOTPConfiguration(ctx context.Context, username string) (config *model.TOTPConfiguration, err error)

LoadTOTPConfiguration load a TOTP configuration given a username from the database.

func (*SQLProvider) LoadTOTPConfigurations added in v4.33.0

func (p *SQLProvider) LoadTOTPConfigurations(ctx context.Context, limit, page int) (configs []model.TOTPConfiguration, err error)

LoadTOTPConfigurations load a set of TOTP configurations.

func (*SQLProvider) LoadUserInfo added in v4.33.0

func (p *SQLProvider) LoadUserInfo(ctx context.Context, username string) (info model.UserInfo, err error)

LoadUserInfo loads the model.UserInfo from the database.

func (*SQLProvider) LoadUserOpaqueIdentifier added in v4.35.0

func (p *SQLProvider) LoadUserOpaqueIdentifier(ctx context.Context, opaqueUUID uuid.UUID) (opaqueID *model.UserOpaqueIdentifier, err error)

LoadUserOpaqueIdentifier selects an opaque user identifier from the database.

func (*SQLProvider) LoadUserOpaqueIdentifierBySignature added in v4.35.0

func (p *SQLProvider) LoadUserOpaqueIdentifierBySignature(ctx context.Context, service, sectorID, username string) (opaqueID *model.UserOpaqueIdentifier, err error)

LoadUserOpaqueIdentifierBySignature selects an opaque user identifier from the database given a service name, sector id, and username.

func (*SQLProvider) LoadUserOpaqueIdentifiers added in v4.35.0

func (p *SQLProvider) LoadUserOpaqueIdentifiers(ctx context.Context) (opaqueIDs []model.UserOpaqueIdentifier, err error)

LoadUserOpaqueIdentifiers selects an opaque user identifiers from the database.

func (*SQLProvider) LoadWebauthnDevices added in v4.34.0

func (p *SQLProvider) LoadWebauthnDevices(ctx context.Context, limit, page int) (devices []model.WebauthnDevice, err error)

LoadWebauthnDevices loads Webauthn device registrations.

func (*SQLProvider) LoadWebauthnDevicesByUsername added in v4.34.0

func (p *SQLProvider) LoadWebauthnDevicesByUsername(ctx context.Context, username string) (devices []model.WebauthnDevice, err error)

LoadWebauthnDevicesByUsername loads all webauthn devices registration for a given username.

func (*SQLProvider) RevokeOAuth2Session added in v4.35.0

func (p *SQLProvider) RevokeOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, signature string) (err error)

RevokeOAuth2Session marks a OAuth2Session as revoked in the database.

func (*SQLProvider) RevokeOAuth2SessionByRequestID added in v4.35.0

func (p *SQLProvider) RevokeOAuth2SessionByRequestID(ctx context.Context, sessionType OAuth2SessionType, requestID string) (err error)

RevokeOAuth2SessionByRequestID marks a OAuth2Session as revoked in the database.

func (*SQLProvider) Rollback added in v4.35.0

func (p *SQLProvider) Rollback(ctx context.Context) (err error)

Rollback performs a database rollback.

func (*SQLProvider) SaveIdentityVerification added in v4.33.0

func (p *SQLProvider) SaveIdentityVerification(ctx context.Context, verification model.IdentityVerification) (err error)

SaveIdentityVerification save an identity verification record to the database.

func (*SQLProvider) SaveOAuth2BlacklistedJTI added in v4.35.0

func (p *SQLProvider) SaveOAuth2BlacklistedJTI(ctx context.Context, blacklistedJTI model.OAuth2BlacklistedJTI) (err error)

SaveOAuth2BlacklistedJTI saves a OAuth2BlacklistedJTI to the database.

func (*SQLProvider) SaveOAuth2ConsentPreConfiguration added in v4.37.0

func (p *SQLProvider) SaveOAuth2ConsentPreConfiguration(ctx context.Context, config model.OAuth2ConsentPreConfig) (insertedID int64, err error)

SaveOAuth2ConsentPreConfiguration inserts an OAuth2.0 consent pre-configuration.

func (*SQLProvider) SaveOAuth2ConsentSession added in v4.35.0

func (p *SQLProvider) SaveOAuth2ConsentSession(ctx context.Context, consent model.OAuth2ConsentSession) (err error)

SaveOAuth2ConsentSession inserts an OAuth2.0 consent session.

func (*SQLProvider) SaveOAuth2ConsentSessionGranted added in v4.35.0

func (p *SQLProvider) SaveOAuth2ConsentSessionGranted(ctx context.Context, id int) (err error)

SaveOAuth2ConsentSessionGranted updates an OAuth2.0 consent recording that it has been granted by the authorization endpoint.

func (*SQLProvider) SaveOAuth2ConsentSessionResponse added in v4.35.0

func (p *SQLProvider) SaveOAuth2ConsentSessionResponse(ctx context.Context, consent model.OAuth2ConsentSession, authorized bool) (err error)

SaveOAuth2ConsentSessionResponse updates an OAuth2.0 consent session with the response.

func (*SQLProvider) SaveOAuth2ConsentSessionSubject added in v4.35.1

func (p *SQLProvider) SaveOAuth2ConsentSessionSubject(ctx context.Context, consent model.OAuth2ConsentSession) (err error)

SaveOAuth2ConsentSessionSubject updates an OAuth2.0 consent session with the subject.

func (*SQLProvider) SaveOAuth2Session added in v4.35.0

func (p *SQLProvider) SaveOAuth2Session(ctx context.Context, sessionType OAuth2SessionType, session model.OAuth2Session) (err error)

SaveOAuth2Session saves a OAuth2Session to the database.

func (*SQLProvider) SavePreferred2FAMethod

func (p *SQLProvider) SavePreferred2FAMethod(ctx context.Context, username string, method string) (err error)

SavePreferred2FAMethod save the preferred method for 2FA to the database.

func (*SQLProvider) SavePreferredDuoDevice added in v4.33.0

func (p *SQLProvider) SavePreferredDuoDevice(ctx context.Context, device model.DuoDevice) (err error)

SavePreferredDuoDevice saves a Duo device.

func (*SQLProvider) SaveTOTPConfiguration added in v4.33.0

func (p *SQLProvider) SaveTOTPConfiguration(ctx context.Context, config model.TOTPConfiguration) (err error)

SaveTOTPConfiguration save a TOTP configuration of a given user in the database.

func (*SQLProvider) SaveUserOpaqueIdentifier added in v4.35.0

func (p *SQLProvider) SaveUserOpaqueIdentifier(ctx context.Context, opaqueID model.UserOpaqueIdentifier) (err error)

SaveUserOpaqueIdentifier saves a new opaque user identifier to the database.

func (*SQLProvider) SaveWebauthnDevice added in v4.34.0

func (p *SQLProvider) SaveWebauthnDevice(ctx context.Context, device model.WebauthnDevice) (err error)

SaveWebauthnDevice saves a registered Webauthn device.

func (*SQLProvider) SchemaEncryptionChangeKey added in v4.33.0

func (p *SQLProvider) SchemaEncryptionChangeKey(ctx context.Context, key string) (err error)

SchemaEncryptionChangeKey uses the currently configured key to decrypt values in the database and the key provided by this command to encrypt the values again and update them using a transaction.

func (*SQLProvider) SchemaEncryptionCheckKey added in v4.33.0

func (p *SQLProvider) SchemaEncryptionCheckKey(ctx context.Context, verbose bool) (result EncryptionValidationResult, err error)

SchemaEncryptionCheckKey checks the encryption key configured is valid for the database.

func (*SQLProvider) SchemaLatestVersion added in v4.33.0

func (p *SQLProvider) SchemaLatestVersion() (version int, err error)

SchemaLatestVersion returns the latest version available for migration.

func (*SQLProvider) SchemaMigrate added in v4.33.0

func (p *SQLProvider) SchemaMigrate(ctx context.Context, up bool, version int) (err error)

SchemaMigrate migrates from the current version to the provided version.

func (*SQLProvider) SchemaMigrationHistory added in v4.33.0

func (p *SQLProvider) SchemaMigrationHistory(ctx context.Context) (migrations []model.Migration, err error)

SchemaMigrationHistory returns migration history rows.

func (*SQLProvider) SchemaMigrationsDown added in v4.33.0

func (p *SQLProvider) SchemaMigrationsDown(ctx context.Context, version int) (migrations []model.SchemaMigration, err error)

SchemaMigrationsDown returns a list of migrations down available between the current version and the provided version.

func (*SQLProvider) SchemaMigrationsUp added in v4.33.0

func (p *SQLProvider) SchemaMigrationsUp(ctx context.Context, version int) (migrations []model.SchemaMigration, err error)

SchemaMigrationsUp returns a list of migrations up available between the current version and the provided version.

func (*SQLProvider) SchemaTables added in v4.33.0

func (p *SQLProvider) SchemaTables(ctx context.Context) (tables []string, err error)

SchemaTables returns a list of tables.

func (*SQLProvider) SchemaVersion added in v4.33.0

func (p *SQLProvider) SchemaVersion(ctx context.Context) (version int, err error)

SchemaVersion returns the version of the schema.

func (*SQLProvider) StartupCheck added in v4.33.0

func (p *SQLProvider) StartupCheck() (err error)

StartupCheck implements the provider startup check interface.

func (*SQLProvider) UpdateTOTPConfigurationSignIn added in v4.34.0

func (p *SQLProvider) UpdateTOTPConfigurationSignIn(ctx context.Context, id int, lastUsedAt sql.NullTime) (err error)

UpdateTOTPConfigurationSignIn updates a registered Webauthn devices sign in information.

func (*SQLProvider) UpdateWebauthnDeviceSignIn added in v4.34.0

func (p *SQLProvider) UpdateWebauthnDeviceSignIn(ctx context.Context, id int, rpid string, lastUsedAt sql.NullTime, signCount uint32, cloneWarning bool) (err error)

UpdateWebauthnDeviceSignIn updates a registered Webauthn devices sign in information.

type SQLXConnection added in v4.37.3

SQLXConnection is a *sqlx.DB or *sqlx.Tx.

type SQLiteProvider

type SQLiteProvider struct {
	SQLProvider
}

SQLiteProvider is a SQLite3 provider.

func NewSQLiteProvider

func NewSQLiteProvider(config *schema.Configuration) (provider *SQLiteProvider)

NewSQLiteProvider constructs a SQLite provider.

Jump to

Keyboard shortcuts

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