services

package
v0.0.0-...-c9003b7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenRepository

type AccessTokenRepository interface {
	// IsValidCredentials lets know if given credentials are valid
	IsValidCredentials(ctx context.Context, login, password string) bool

	// GetClaims return data how must be store in JWT token
	GetClaims(ctx context.Context, login string) jwt.MapClaims

	// IsValidAccessToken is an optional function that allows you
	// to add additional check for validate access token
	IsValidAccessToken(ctx context.Context, token string) bool

	// ManageAccessToken is an optional function that allows you
	// to perform actions after generating an access token (like store it)
	ManageAccessToken(ctx context.Context, token string, exp *time.Time)

	// SetCookie is an optional function that allows you to set cookie if
	// you enabled cookie
	SetCookie(ctx context.Context, name, value string, exp *time.Time) fiber.Cookie
}

type FactorsRepository

type FactorsRepository interface {
	// IsEnabled check if a 2FA is enabled on this login
	IsEnabled(ctx context.Context, login string) bool

	// GetAvailableFactors return a list of active 2FA
	GetAvailableFactors(ctx context.Context, login string) []string

	// GetDefaultFactor return default factor for given login
	GetDefaultFactor(ctx context.Context, login string) string
}

type RefreshTokenRepository

type RefreshTokenRepository interface {
	// IsValidRefreshToken lets know if refresh token is valid
	IsValidRefreshToken(ctx context.Context, token string) bool

	// DeleteRefreshToken allows to delete refresh token
	DeleteRefreshToken(ctx context.Context, token string)

	// ManageRefreshToken allows you to perform actions after
	// generating a refresh token (like store it)
	ManageRefreshToken(ctx context.Context, token string, exp *time.Time)
}

type RegisterRepository

type RegisterRepository interface {
	// CreateAccount allows to create account,
	// the return must return the final object for response
	CreateAccount(ctx context.Context, payload map[string]interface{}) (p interface{}, err error)
}

type SMSRepository

type SMSRepository interface {
}

type TOTPRepository

type TOTPRepository interface {
	// IsEnabled check if TOTP is already enabled on this login
	IsEnabled(ctx context.Context, login string) bool

	// GetSharedSecretKey retrieves the shared secret key based on a login string
	GetSharedSecretKey(ctx context.Context, login string) string

	// Enable allows to enable TOTP
	Enable(ctx context.Context, key string)

	// Disable allows to disable TOTP
	Disable(ctx context.Context, login string)

	// StoreRecoveryCodes stores a list of recovery codes,
	// which can be used to recover access to the account
	// in case of loss or damage to the primary authentication mechanism.
	StoreRecoveryCodes(ctx context.Context, codes []string)
}

Jump to

Keyboard shortcuts

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