services

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorPasscodeInvalid            = errors.New("passcode invalid")
	ErrorPasscodeNotFound           = errors.New("passcode not found")
	ErrorPasscodeExpired            = errors.New("passcode is expired")
	ErrorPasscodeMaxAttemptsReached = errors.New("the passcode was entered wrong too many times")
)
View Source
var (
	ErrInvalidWebauthnCredential        = errors.New("this passkey cannot be used anymore")
	ErrInvalidWebauthnCredentialMFAOnly = errors.New("this credential can be used as a second factor security key only")
)
View Source
var (
	ErrorPasswordInvalid = errors.New("password invalid")
)

Functions

func UserCanDoSaml

func UserCanDoSaml(cfg config.Config, identities models.Identities) bool

func UserCanDoThirdParty

func UserCanDoThirdParty(cfg config.Config, identities models.Identities) bool

func ValidateUsername

func ValidateUsername(name string) bool

Types

type DeviceTrustService added in v1.3.0

type DeviceTrustService struct {
	Persister   persistence.TrustedDevicePersister
	Cfg         config.Config
	HttpContext echo.Context
}

func (DeviceTrustService) CheckDeviceTrust added in v1.3.0

func (s DeviceTrustService) CheckDeviceTrust(userID uuid.UUID) bool

func (DeviceTrustService) CreateTrustedDevice added in v1.3.0

func (s DeviceTrustService) CreateTrustedDevice(userID uuid.UUID, deviceToken string) error

func (DeviceTrustService) GenerateRandomToken added in v1.3.0

func (s DeviceTrustService) GenerateRandomToken(length int) (string, error)

type Email

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

func NewEmailService

func NewEmailService(cfg config.Config) (*Email, error)

func (*Email) RenderBody added in v1.0.1

func (s *Email) RenderBody(lang, template string, data map[string]interface{}) (string, error)

RenderBody renders the body with the given template. The template name must be the name of the template without the content type and the file ending. E.g. when the file is created as "email_verification_text.tmpl" then the template name is just "email_verification"

func (*Email) RenderSubject added in v1.0.1

func (s *Email) RenderSubject(lang, template string, data map[string]interface{}) string

RenderSubject renders a subject with the given template. Must be "subject_[template_name]".

func (*Email) SendEmail

func (s *Email) SendEmail(emailAddress, subject, body string) error

SendEmail sends an email to the emailAddress with the given subject and body.

type GenerateCreationOptionsParams

type GenerateCreationOptionsParams struct {
	Tx       *pop.Connection
	UserID   uuid.UUID
	Email    *string
	Username *string
}

type GenerateRequestOptionsPasskeyParams added in v1.2.0

type GenerateRequestOptionsPasskeyParams struct {
	Tx *pop.Connection
}

type GenerateRequestOptionsSecurityKeyParams added in v1.2.0

type GenerateRequestOptionsSecurityKeyParams struct {
	Tx     *pop.Connection
	UserID uuid.UUID
}

type Passcode

type Passcode interface {
	ValidatePasscode(ValidatePasscodeParams) (bool, error)
	SendPasscode(*pop.Connection, SendPasscodeParams) (*SendPasscodeResult, error)
	VerifyPasscodeCode(tx *pop.Connection, passcodeID uuid.UUID, passcode string) error
}

func NewPasscodeService

func NewPasscodeService(cfg config.Config, emailService Email, persister persistence.Persister) Passcode

type Password

type Password interface {
	VerifyPassword(tx *pop.Connection, userId uuid.UUID, password string) error
	RecoverPassword(tx *pop.Connection, userId uuid.UUID, newPassword string) error
	CreatePassword(tx *pop.Connection, userId uuid.UUID, newPassword string) error
	UpdatePassword(tx *pop.Connection, passwordCredentialModel *models.PasswordCredential, newPassword string) error
}

func NewPasswordService

func NewPasswordService(persister persistence.Persister) Password

type SendPasscodeParams

type SendPasscodeParams struct {
	Template     string
	EmailAddress string
	Language     string
}

type SendPasscodeResult added in v1.0.1

type SendPasscodeResult struct {
	PasscodeModel models.Passcode
	Subject       string
	Body          string
	Code          string
}

type ValidatePasscodeParams

type ValidatePasscodeParams struct {
	Tx         *pop.Connection
	PasscodeID uuid.UUID
}

type VerifyAssertionResponseParams

type VerifyAssertionResponseParams struct {
	Tx                *pop.Connection
	SessionDataID     uuid.UUID
	AssertionResponse string
	IsMFA             bool
}

type VerifyAttestationResponseParams

type VerifyAttestationResponseParams struct {
	Tx            *pop.Connection
	SessionDataID uuid.UUID
	PublicKey     string
	UserID        uuid.UUID
	Email         *string
	Username      *string
}

Jump to

Keyboard shortcuts

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