Documentation
¶
Index ¶
- type AuthnModule
- type AuthzModule
- type HandlerComponent
- type IDPModule
- func (m *IDPModule) CacheFamilyInspectors() []cacheinfra.FamilyInspector
- func (m *IDPModule) Initialize(params ...interface{}) error
- func (m *IDPModule) Repository() wechatappDomain.Repository
- func (m *IDPModule) SecretVault() wechatappDomain.SecretVault
- func (m *IDPModule) WechatAuthProvider() wechatapiPort.AuthProvider
- type Module
- type ModuleInfo
- type RepoComponent
- type ServiceComponent
- type SuggestModule
- type UserModule
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 (*AuthnModule) CacheFamilyInspectors ¶
func (m *AuthnModule) CacheFamilyInspectors() []cacheinfra.FamilyInspector
CacheFamilyInspectors 返回认证模块暴露的缓存族状态读取器。
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 (*AuthzModule) Initialize ¶
func (m *AuthzModule) Initialize(db *gorm.DB, versionNotifier policyDomain.VersionNotifier) error
Initialize 初始化授权模块 versionNotifier: 策略版本通知器(可选,传 nil 则不发送通知)
type HandlerComponent ¶
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 (*IDPModule) CacheFamilyInspectors ¶
func (m *IDPModule) CacheFamilyInspectors() []cacheinfra.FamilyInspector
CacheFamilyInspectors 返回 IDP 模块暴露的缓存族状态读取器。
func (*IDPModule) Initialize ¶
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 ¶
ModuleInfo 模块信息
type RepoComponent ¶
RepoComponent 响应组件
type ServiceComponent ¶
ServiceComponent 服务组件
type SuggestModule ¶
type SuggestModule struct {
Service *appsuggest.Service
Updater *appsuggest.Updater
// contains filtered or unexported fields
}
SuggestModule 联想搜索模块
func (*SuggestModule) CheckHealth ¶
func (m *SuggestModule) CheckHealth() error
CheckHealth 检查是否已加载数据
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 (*UserModule) Initialize ¶
func (m *UserModule) Initialize(params ...interface{}) error
Initialize 初始化模块