storage

package
v3.16.3-0...-b1d59dc Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoU2FDeviceHandle error thrown when no U2F device handle has been found in DB.
	ErrNoU2FDeviceHandle = errors.New("No U2F device handle found")
)

Functions

This section is empty.

Types

type AuthenticationLogDocument

type AuthenticationLogDocument struct {
	UserID  string    `bson:"userId"`
	Time    time.Time `bson:"time"`
	Success bool      `bson:"success"`
}

AuthenticationLogDocument model of document storing authentication logs

type IdentityTokenDocument

type IdentityTokenDocument struct {
	Token string `bson:"token"`
}

IdentityTokenDocument model for the identiy token documents.

type MongoProvider

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

MongoProvider is a storage provider persisting data in a SQLite database.

func NewMongoProvider

func NewMongoProvider(configuration schema.MongoStorageConfiguration) *MongoProvider

NewMongoProvider construct a mongo provider.

func (*MongoProvider) AppendAuthenticationLog

func (p *MongoProvider) AppendAuthenticationLog(attempt models.AuthenticationAttempt) error

AppendAuthenticationLog append a mark to the authentication log.

func (*MongoProvider) FindIdentityVerificationToken

func (p *MongoProvider) FindIdentityVerificationToken(token string) (bool, error)

FindIdentityVerificationToken look for an identity verification token in DB.

func (*MongoProvider) LoadLatestAuthenticationLogs

func (p *MongoProvider) LoadLatestAuthenticationLogs(username string, fromDate time.Time) ([]models.AuthenticationAttempt, error)

LoadLatestAuthenticationLogs retrieve the latest marks from the authentication log.

func (*MongoProvider) LoadPrefered2FAMethod

func (p *MongoProvider) LoadPrefered2FAMethod(username string) (string, error)

LoadPrefered2FAMethod load the prefered method for 2FA from sqlite db.

func (*MongoProvider) LoadTOTPSecret

func (p *MongoProvider) LoadTOTPSecret(username string) (string, error)

LoadTOTPSecret load a TOTP secret given a username.

func (*MongoProvider) LoadU2FDeviceHandle

func (p *MongoProvider) LoadU2FDeviceHandle(username string) ([]byte, error)

LoadU2FDeviceHandle load a U2F device registration blob for a given username.

func (*MongoProvider) RemoveIdentityVerificationToken

func (p *MongoProvider) RemoveIdentityVerificationToken(token string) error

RemoveIdentityVerificationToken remove an identity verification token from the DB.

func (*MongoProvider) SaveIdentityVerificationToken

func (p *MongoProvider) SaveIdentityVerificationToken(token string) error

SaveIdentityVerificationToken save an identity verification token in DB.

func (*MongoProvider) SavePrefered2FAMethod

func (p *MongoProvider) SavePrefered2FAMethod(username string, method string) error

SavePrefered2FAMethod save the prefered method for 2FA in sqlite db.

func (*MongoProvider) SaveTOTPSecret

func (p *MongoProvider) SaveTOTPSecret(username string, secret string) error

SaveTOTPSecret save a TOTP secret of a given user.

func (*MongoProvider) SaveU2FDeviceHandle

func (p *MongoProvider) SaveU2FDeviceHandle(username string, deviceBytes []byte) error

SaveU2FDeviceHandle save a registered U2F device registration blob.

type Provider

type Provider interface {
	LoadPrefered2FAMethod(username string) (string, error)
	SavePrefered2FAMethod(username string, method string) error

	FindIdentityVerificationToken(token string) (bool, error)
	SaveIdentityVerificationToken(token string) error
	RemoveIdentityVerificationToken(token string) error

	SaveTOTPSecret(username string, secret string) error
	LoadTOTPSecret(username string) (string, error)

	SaveU2FDeviceHandle(username string, device []byte) error
	LoadU2FDeviceHandle(username string) ([]byte, error)

	AppendAuthenticationLog(attempt models.AuthenticationAttempt) error
	LoadLatestAuthenticationLogs(username string, fromDate time.Time) ([]models.AuthenticationAttempt, error)
}

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

type SQLiteProvider

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

SQLiteProvider is a storage provider persisting data in a SQLite database.

func NewSQLiteProvider

func NewSQLiteProvider(path string) *SQLiteProvider

NewSQLiteProvider construct a sqlite provider.

func (*SQLiteProvider) AppendAuthenticationLog

func (p *SQLiteProvider) AppendAuthenticationLog(attempt models.AuthenticationAttempt) error

AppendAuthenticationLog append a mark to the authentication log.

func (*SQLiteProvider) FindIdentityVerificationToken

func (p *SQLiteProvider) FindIdentityVerificationToken(token string) (bool, error)

FindIdentityVerificationToken look for an identity verification token in DB.

func (*SQLiteProvider) LoadLatestAuthenticationLogs

func (p *SQLiteProvider) LoadLatestAuthenticationLogs(username string, fromDate time.Time) ([]models.AuthenticationAttempt, error)

LoadLatestAuthenticationLogs retrieve the latest marks from the authentication log.

func (*SQLiteProvider) LoadPrefered2FAMethod

func (p *SQLiteProvider) LoadPrefered2FAMethod(username string) (string, error)

LoadPrefered2FAMethod load the prefered method for 2FA from sqlite db.

func (*SQLiteProvider) LoadTOTPSecret

func (p *SQLiteProvider) LoadTOTPSecret(username string) (string, error)

LoadTOTPSecret load a TOTP secret given a username.

func (*SQLiteProvider) LoadU2FDeviceHandle

func (p *SQLiteProvider) LoadU2FDeviceHandle(username string) ([]byte, error)

LoadU2FDeviceHandle load a U2F device registration blob for a given username.

func (*SQLiteProvider) RemoveIdentityVerificationToken

func (p *SQLiteProvider) RemoveIdentityVerificationToken(token string) error

RemoveIdentityVerificationToken remove an identity verification token from the DB.

func (*SQLiteProvider) SaveIdentityVerificationToken

func (p *SQLiteProvider) SaveIdentityVerificationToken(token string) error

SaveIdentityVerificationToken save an identity verification token in DB.

func (*SQLiteProvider) SavePrefered2FAMethod

func (p *SQLiteProvider) SavePrefered2FAMethod(username string, method string) error

SavePrefered2FAMethod save the prefered method for 2FA in sqlite db.

func (*SQLiteProvider) SaveTOTPSecret

func (p *SQLiteProvider) SaveTOTPSecret(username string, secret string) error

SaveTOTPSecret save a TOTP secret of a given user.

func (*SQLiteProvider) SaveU2FDeviceHandle

func (p *SQLiteProvider) SaveU2FDeviceHandle(username string, keyHandle []byte) error

SaveU2FDeviceHandle save a registered U2F device registration blob.

type TOTPSecretDocument

type TOTPSecretDocument struct {
	UserID string `bson:"userId"`
	Secret string `bson:"secret"`
}

TOTPSecretDocument model of document storing TOTP secrets

type U2FDeviceDocument

type U2FDeviceDocument struct {
	UserID       string `bson:"userId"`
	DeviceHandle []byte `bson:"deviceHandle"`
}

U2FDeviceDocument model of document storing U2F device

Jump to

Keyboard shortcuts

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