services

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: AGPL-3.0 Imports: 17 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")
)
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 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 GenerateRequestOptionsParams

type GenerateRequestOptionsParams struct {
	Tx *pop.Connection
}

type Passcode

type Passcode interface {
	ValidatePasscode(ValidatePasscodeParams) (bool, error)
	SendPasscode(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(userId uuid.UUID, password string) error
	RecoverPassword(userId uuid.UUID, newPassword string) error
	CreatePassword(userId uuid.UUID, newPassword string) error
	UpdatePassword(passwordCredentialModel *models.PasswordCredential, newPassword string) error
}

func NewPasswordService

func NewPasswordService(cfg config.Config, 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
}

type VerifyAttestationResponseParams

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

type WebauthnService

func NewWebauthnService

func NewWebauthnService(cfg config.Config, persister persistence.Persister) WebauthnService

Jump to

Keyboard shortcuts

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