oauth

package
v1.14.21 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OAuthGoogle   = "google"
	OAuthApple    = "apple"
	OAuthTelegram = "telegram"
	OAuthGithub   = "github"
	AuthEmail     = "email"
	AuthExpire    = 86400
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleLoginCallbackDependencies added in v1.14.18

type AppleLoginCallbackDependencies struct {
	Redis            *redis.Client
	FallbackRedirect string
}

AppleLoginCallbackDependencies explicitly declares the state store and fallback redirect used by the Apple OAuth callback instead of passing ServiceContext to business logic.

type AppleLoginCallbackLogic

type AppleLoginCallbackLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewAppleLoginCallbackLogic

func NewAppleLoginCallbackLogic(ctx context.Context, deps AppleLoginCallbackDependencies) *AppleLoginCallbackLogic

Apple Login Callback

func (*AppleLoginCallbackLogic) AppleLoginCallback

type AppleLoginRedirect added in v1.3.13

type AppleLoginRedirect struct {
	StatusCode int
	Location   string
}

type OAuthLoginConfig added in v1.14.18

type OAuthLoginConfig struct {
	InviteForced            bool
	OnlyFirstPurchase       bool
	EmailDomainSuffixList   string
	EmailEnableDomainSuffix bool
	TrialEnabled            bool
	TrialSubscribeID        int64
	TrialTime               int64
	TrialTimeUnit           string
	JWTAccessSecret         string
	JWTAccessExpire         int64
}

OAuthLoginConfig is the configuration snapshot consumed by the OAuth login and registration flow.

type OAuthLoginDependencies added in v1.14.18

type OAuthLoginDependencies struct {
	Store  OAuthLoginStore
	Redis  *redis.Client
	Config OAuthLoginConfig
	Policy OAuthRegistrationPolicy
}

OAuthLoginDependencies contains the explicit collaborators of the OAuth login use case. It replaces the application-wide ServiceContext dependency.

type OAuthLoginGetTokenLogic

type OAuthLoginGetTokenLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewOAuthLoginGetTokenLogic

func NewOAuthLoginGetTokenLogic(ctx context.Context, deps OAuthLoginDependencies) *OAuthLoginGetTokenLogic

NewOAuthLoginGetTokenLogic OAuth login get token

func (*OAuthLoginGetTokenLogic) OAuthLoginGetToken

func (l *OAuthLoginGetTokenLogic) OAuthLoginGetToken(req *dto.OAuthLoginGetTokenRequest, ip, userAgent string) (resp *dto.LoginResponse, err error)

type OAuthLoginLogic

type OAuthLoginLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewOAuthLoginLogic

func NewOAuthLoginLogic(ctx context.Context, deps OAuthLoginURLDependencies) *OAuthLoginLogic

OAuth login

func (*OAuthLoginLogic) OAuthLogin

func (l *OAuthLoginLogic) OAuthLogin(req *dto.OAthLoginRequest) (resp *dto.OAuthLoginResponse, err error)

type OAuthLoginStore added in v1.14.18

type OAuthLoginStore interface {
	Auth() repository.AuthRepo
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	UserSubscription() repository.UserSubscriptionRepo
	UserCache() repository.UserCacheRepo
	Subscribe() repository.SubscribeRepo
	Log() repository.LogRepo
	InTx(ctx context.Context, fn func(repository.Store) error) error
}

OAuthLoginStore is the persistence surface required by OAuth login and registration. It intentionally excludes unrelated Store domains.

type OAuthLoginURLDependencies added in v1.14.18

type OAuthLoginURLDependencies struct {
	Store  OAuthLoginURLStore
	Redis  *redis.Client
	Policy OAuthLoginURLPolicy
}

OAuthLoginURLDependencies explicitly declares the collaborators of OAuth authorization URL creation instead of passing ServiceContext to business logic.

type OAuthLoginURLPolicy added in v1.14.18

type OAuthLoginURLPolicy interface {
	EnsureMethodEnabled(ctx context.Context, method string) error
}

OAuthLoginURLPolicy contains the authentication-method policy required when creating an OAuth authorization URL.

type OAuthLoginURLStore added in v1.14.18

type OAuthLoginURLStore interface {
	Auth() repository.AuthRepo
}

OAuthLoginURLStore is the persistence surface used to load OAuth provider configuration. It excludes unrelated application repositories.

type OAuthRegistrationPolicy added in v1.14.18

type OAuthRegistrationPolicy interface {
	EnsureMethodEnabled(ctx context.Context, method string) error
	EnsureRegistrationOpen(ctx context.Context, method string) error
	VerifyHuman(ctx context.Context, token, ip string) error
	TakeIPPermit(ctx context.Context, ip string) error
}

OAuthRegistrationPolicy isolates registration policy enforcement from the OAuth use case's infrastructure composition.

Jump to

Keyboard shortcuts

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