biz

package
v0.0.0-...-e04cc49 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const GoogleOauthState = "google_oauth_state"
View Source
const GooglePKCEKey = "google_pkce_verifier"
View Source
const (
	OAuthProviderGoogle = "google"
)

Variables

Functions

This section is empty.

Types

type GoogleUserInfo

type GoogleUserInfo struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Picture       string `json:"picture"`
	Name          string `json:"name"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Locale        string `json:"locale"`
}

func (GoogleUserInfo) Map

func (r GoogleUserInfo) Map() map[string]any

type OAuthUseCase

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

func NewOAuthUseCase

func NewOAuthUseCase(google *oauth2.Config) *OAuthUseCase

func (OAuthUseCase) GoogleUserInfo

func (r OAuthUseCase) GoogleUserInfo(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*GoogleUserInfo, error)

type UserRepo

type UserRepo interface {
	FindUserByOAuth(ctx context.Context, provider string, providerUserID string) (*ent.User, error)
	FindUserByEmail(ctx context.Context, email string) (*ent.User, error)
	BindOAuthAccount(ctx context.Context, data ent.OAuthAccount) error
	UnBindOAuthAccount(ctx context.Context, userID int, provider string) error
	CreateUser(ctx context.Context, user ent.User) (*ent.User, error)
	GetTenantUserPermissionKeys(ctx context.Context, tenantUserID int) ([]string, error)
}

type UserUseCase

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

func NewUserUseCase

func NewUserUseCase(cfg *conf.Config) *UserUseCase

func (UserUseCase) CheckEmailVerifyCode

func (r UserUseCase) CheckEmailVerifyCode(email string, emailType model.VerifyCodeType, code string) bool

func (UserUseCase) GenerateToken

func (r UserUseCase) GenerateToken(userID int) (string, int, error)

func (UserUseCase) SendEmail

func (r UserUseCase) SendEmail(email string, emailType model.VerifyCodeType) error

Jump to

Keyboard shortcuts

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