assembler

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthnModule

type AuthnModule struct {
	// 应用服务
	AccountService          accountApp.AccountApplicationService
	RegisterService         registerApp.RegisterApplicationService
	LoginService            login.LoginApplicationService
	LoginPreparationService loginprep.LoginPreparationService
	TokenService            token.TokenApplicationService
	SessionService          sessionApp.SessionApplicationService

	// JWKS 应用服务
	KeyManagementApp *jwksApp.KeyManagementAppService
	KeyPublishApp    *jwksApp.KeyPublishAppService
	KeyRotationApp   *jwksApp.KeyRotationAppService

	// HTTP 处理器
	AccountHandler      *authhandler.AccountHandler
	AuthHandler         *authhandler.AuthHandler
	JWKSHandler         *authhandler.JWKSHandler
	SessionAdminHandler *authhandler.SessionAdminHandler

	// gRPC 服务
	GRPCService *authngrpc.Service

	// 调度器
	RotationScheduler interface {
		Start(ctx context.Context) error
		Stop() error
		IsRunning() bool
		TriggerNow(ctx context.Context) error
	}
	// contains filtered or unexported fields
}

AuthnModule 认证模块

func NewAuthnModule

func NewAuthnModule() *AuthnModule

NewAuthnModule 创建认证模块

func (*AuthnModule) CacheFamilyInspectors

func (m *AuthnModule) CacheFamilyInspectors() []cacheinfra.FamilyInspector

CacheFamilyInspectors 返回认证模块暴露的缓存族状态读取器。

func (*AuthnModule) Cleanup

func (m *AuthnModule) Cleanup(ctx context.Context) error

Cleanup 清理资源

func (*AuthnModule) Initialize

func (m *AuthnModule) Initialize(params ...interface{}) error

Initialize 初始化模块 params[0]: *gorm.DB params[1]: *redis.Client 可选参数:

  • authentication.PasswordHasher 自定义密码哈希器
  • *IDPModule 注入 IDP 模块提供的基础设施能力
  • messaging.EventBus 可选;sms.provider=mq 时用于发布登录 OTP 短信任务

func (*AuthnModule) SessionManager

func (m *AuthnModule) SessionManager() sessionDomain.Manager

SessionManager 返回认证模块创建的会话管理器。

type AuthzModule

type AuthzModule struct {
	// HTTP Handlers
	RoleHandler       *handler.RoleHandler
	AssignmentHandler *handler.AssignmentHandler
	PolicyHandler     *handler.PolicyHandler
	ResourceHandler   *handler.ResourceHandler
	CheckHandler      *handler.CheckHandler
	GRPCService       *authzgrpc.Service

	// CasbinAdapter 运行时策略引擎(供 HTTP/gRPC/中间件复用)
	CasbinAdapter policyDomain.CasbinAdapter
}

AuthzModule 授权模块

func NewAuthzModule

func NewAuthzModule() *AuthzModule

NewAuthzModule 创建授权模块

func (*AuthzModule) Initialize

func (m *AuthzModule) Initialize(db *gorm.DB, versionNotifier policyDomain.VersionNotifier) error

Initialize 初始化授权模块 versionNotifier: 策略版本通知器(可选,传 nil 则不发送通知)

type HandlerComponent

type HandlerComponent struct {
	Name        string
	Description string
	Handler     interface{}
}

HandlerComponent 处理器组件

type IDPModule

type IDPModule struct {
	// 应用服务(对外暴露)
	WechatAppService           wechatapp.WechatAppApplicationService
	WechatAppCredentialService wechatapp.WechatAppCredentialApplicationService
	WechatAppTokenService      wechatapp.WechatAppTokenApplicationService

	// HTTP 处理器(对外暴露)
	WechatAppHandler *handler.WechatAppHandler

	// gRPC 服务(对外暴露)
	GRPCService *idpGrpc.Service
	// contains filtered or unexported fields
}

IDPModule IDP 模块(Identity Provider) 负责组装 IDP 相关的所有组件

架构说明: - 直接在容器侧管理基础设施组件,无需中间聚合器 - 遵循六边形架构:Infrastructure -> Domain -> Application -> Interface

职责: - 微信应用管理(HTTP 接口) - 提供基础设施服务(供 authn 模块使用) - 认证功能由 authn 模块统一提供

func NewIDPModule

func NewIDPModule() *IDPModule

NewIDPModule 创建 IDP 模块

func (*IDPModule) CacheFamilyInspectors

func (m *IDPModule) CacheFamilyInspectors() []cacheinfra.FamilyInspector

CacheFamilyInspectors 返回 IDP 模块暴露的缓存族状态读取器。

func (*IDPModule) Initialize

func (m *IDPModule) Initialize(params ...interface{}) error

Initialize 初始化模块 params[0]: *gorm.DB - 数据库连接 params[1]: *redis.Client - Redis 客户端 params[2]: []byte - 加密密钥(32 字节 AES-256)

func (*IDPModule) Repository

func (m *IDPModule) Repository() wechatappDomain.Repository

Repository 返回微信应用查询能力(供 authn 模块读取配置)

func (*IDPModule) SecretVault

func (m *IDPModule) SecretVault() wechatappDomain.SecretVault

SecretVault 返回密钥托管能力(供 authn 模块解密 AppSecret)

func (*IDPModule) WechatAuthProvider

func (m *IDPModule) WechatAuthProvider() wechatapiPort.AuthProvider

WechatAuthProvider 返回微信认证基础能力(调用微信 code2Session 等接口)

type Module

type Module interface {
	Initialize(params ...interface{}) error
	CheckHealth() error
	Cleanup() error
	ModuleInfo() ModuleInfo
}

Module 模块接口

type ModuleInfo

type ModuleInfo struct {
	Name        string
	Version     string
	Description string
}

ModuleInfo 模块信息

type RepoComponent

type RepoComponent struct {
	Name        string
	Description string
	Repository  interface{}
}

RepoComponent 响应组件

type ServiceComponent

type ServiceComponent struct {
	Name        string
	Description string
	Service     interface{}
}

ServiceComponent 服务组件

type SuggestModule

type SuggestModule struct {
	Service *appsuggest.Service
	Updater *appsuggest.Updater
	// contains filtered or unexported fields
}

SuggestModule 联想搜索模块

func NewSuggestModule

func NewSuggestModule() *SuggestModule

NewSuggestModule 创建模块

func (*SuggestModule) CheckHealth

func (m *SuggestModule) CheckHealth() error

CheckHealth 检查是否已加载数据

func (*SuggestModule) Cleanup

func (m *SuggestModule) Cleanup() error

Cleanup 停止调度

func (*SuggestModule) Initialize

func (m *SuggestModule) Initialize(params ...interface{}) error

Initialize 初始化模块 params[0]: *gorm.DB params[1]: config.Config (可选,默认从 viper 读取)

func (*SuggestModule) ModuleInfo

func (m *SuggestModule) ModuleInfo() ModuleInfo

ModuleInfo 返回模块信息

type UserModule

type UserModule struct {
	// handler 层
	UserHandler         *handler.UserHandler
	ChildHandler        *handler.ChildHandler
	GuardianshipHandler *handler.GuardianshipHandler
	// gRPC 服务
	GRPCService *ucGrpc.Service
}

UserModule 用户模块 负责组装用户相关的所有组件

func NewUserModule

func NewUserModule() *UserModule

NewUserModule 创建用户模块

func (*UserModule) CheckHealth

func (m *UserModule) CheckHealth() error

CheckHealth 检查模块健康状态

func (*UserModule) Cleanup

func (m *UserModule) Cleanup() error

Cleanup 清理模块资源

func (*UserModule) Initialize

func (m *UserModule) Initialize(params ...interface{}) error

Initialize 初始化模块

func (*UserModule) ModuleInfo

func (m *UserModule) ModuleInfo() ModuleInfo

ModuleInfo 返回模块信息

Jump to

Keyboard shortcuts

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