Help us shape the future of Go! Take the 2026 Go Developer Survey

authentication

package
v1.3.173 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SocialLoginGoogle   = "google"
	SocialLoginFacebook = "facebook"
	SocialLoginApple    = "apple"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProviderEntity added in v0.3.1

type AuthProviderEntity interface {
	beeorm.Entity
	AuthenticatableEntity
	GetUniqueFieldName() string
	GetPassword() string
}

type AuthenticatableEntity added in v0.9.69

type AuthenticatableEntity interface {
	beeorm.Entity
	CanAuthenticate() bool
}

type Authentication

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

func NewAuthenticationService

func NewAuthenticationService(
	secret string,
	accessTokenTTL int,
	refreshTokenTTL int,
	otpTTL int,
	otpLength int,
	appService *app.App,
	generatorService generator.IGenerator,
	errorLoggerService errorlogger.ErrorLogger,
	clockService clock.IClock,
	passwordService password.IPassword,
	jwtService *jwt.JWT,
	mailService *mail.ISender,
	socialServiceMapping map[string]social.IUserData,
	uuidService uuid.IUUID,
) *Authentication

func (*Authentication) Authenticate

func (t *Authentication) Authenticate(
	ormService *beeorm.Engine,
	uniqueValue string,
	password string,
	entity AuthProviderEntity,
) (accessToken string, refreshToken string, err error)

func (*Authentication) AuthenticateByID added in v0.5.0

func (t *Authentication) AuthenticateByID(
	ormService *beeorm.Engine,
	id uint64,
	entity AuthProviderEntity,
) (accessToken string, refreshToken string, err error)

func (*Authentication) AuthenticateEmail added in v1.0.78

func (t *Authentication) AuthenticateEmail(
	ormService *beeorm.Engine,
	email string,
	password string,
	entity EmailAuthEntity,
) (accessToken string, refreshToken string, err error)

func (*Authentication) AuthenticateOTP added in v0.3.3

func (t *Authentication) AuthenticateOTP(
	ormService *beeorm.Engine,
	phone string,
	entity OTPProviderEntity,
) (accessToken string, refreshToken string, err error)

func (*Authentication) AuthenticateOTPEmail added in v0.5.8

func (t *Authentication) AuthenticateOTPEmail(
	ormService *beeorm.Engine,
	email string,
	entity OTPProviderEntity,
	useRedisSearch bool,
) (accessToken string, refreshToken string, err error)

func (*Authentication) GenerateTokenPair added in v0.3.1

func (t *Authentication) GenerateTokenPair(id uint64, accessKey string, ttl int) (string, error)

func (*Authentication) LogoutAllSessions added in v0.3.1

func (t *Authentication) LogoutAllSessions(ormService *beeorm.Engine, id uint64)

func (*Authentication) LogoutCurrentSession added in v0.3.1

func (t *Authentication) LogoutCurrentSession(ormService *beeorm.Engine, accessKey string)

func (*Authentication) RefreshToken

func (t *Authentication) RefreshToken(ormService *beeorm.Engine, refreshToken string) (newAccessToken string, newRefreshToken string, err error)

func (*Authentication) VerifyAccessToken

func (t *Authentication) VerifyAccessToken(ormService *beeorm.Engine, accessToken string, entity beeorm.Entity) (map[string]string, error)

func (*Authentication) VerifyAccessTokenTemporary added in v1.3.85

func (t *Authentication) VerifyAccessTokenTemporary(ormService *beeorm.Engine, accessToken string, entity beeorm.Entity) (map[string]string, error)

func (*Authentication) VerifySocialLogin added in v0.6.2

func (t *Authentication) VerifySocialLogin(ctx context.Context, source, token string, isAndroid bool) (*social.UserData, error)

type EmailAuthEntity added in v1.0.78

type EmailAuthEntity interface {
	beeorm.Entity
	AuthenticatableEntity
	GetPassword() string
	GetEmailFieldName() string
}

type GenerateOTP added in v0.3.3

type GenerateOTP struct {
	Mobile         string
	ExpirationTime string
	Token          string
}

type OTPProviderEntity added in v0.3.3

type OTPProviderEntity interface {
	beeorm.Entity
	AuthenticatableEntity
	GetPhoneFieldName() string
	GetEmailFieldName() string
}

Jump to

Keyboard shortcuts

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