assembler

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 67 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthnApplicationCapabilities

type AuthnApplicationCapabilities struct {
	AccountService          accountApp.AccountApplicationService
	AccountOnboarder        onboardingApp.AccountOnboarder
	LoginService            login.LoginApplicationService
	LoginPreparationService loginprep.LoginPreparationService
	TokenService            token.TokenApplicationService
	SessionService          sessionApp.SessionApplicationService
	KeyManagementApp        *jwksApp.KeyManagementAppService
	KeyPublishApp           *jwksApp.KeyPublishAppService
	KeyRotationApp          *jwksApp.KeyRotationAppService
}

AuthnApplicationCapabilities contains authn application collaborators used by transports without exposing concrete transport objects from assembler.

type AuthnModule

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

AuthnModule 认证模块

func NewAuthnModule

func NewAuthnModule() *AuthnModule

NewAuthnModule 创建认证模块

func (*AuthnModule) ApplicationCapabilities

func (m *AuthnModule) ApplicationCapabilities() AuthnApplicationCapabilities

func (*AuthnModule) CacheFamilyInspectors

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

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

func (*AuthnModule) Cleanup

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

Cleanup 清理资源

func (*AuthnModule) InitializeWithDeps

func (m *AuthnModule) InitializeWithDeps(deps AuthnModuleDeps) error

InitializeWithDeps initializes the module through typed dependencies.

func (*AuthnModule) RuntimeCapabilities

func (m *AuthnModule) RuntimeCapabilities() AuthnRuntimeCapabilities

func (*AuthnModule) SessionManager

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

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

type AuthnModuleDeps

type AuthnModuleDeps struct {
	DB             *gorm.DB
	RedisClient    *redis.Client
	PasswordHasher authentication.PasswordHasher
	IDPModule      *IDPModule
	EventBus       messaging.EventBus
	EventPublisher event.Publisher
	AppMode        string
	Auth           apiserveroptions.AuthOptions
	JWKS           apiserveroptions.JWKSOptions
	IDPOptions     apiserveroptions.IDPOptions
	SMS            apiserveroptions.SMSOptions
}

AuthnModuleDeps contains the runtime dependencies required to assemble the authentication module.

type AuthnRuntimeCapabilities

type AuthnRuntimeCapabilities struct {
	RotationScheduler KeyRotationScheduler
}

type AuthzApplicationCapabilities

type AuthzApplicationCapabilities struct {
	ResourceCatalog             authzResourceApp.Catalog
	ResourceDirectory           authzResourceApp.Directory
	RoleCatalog                 authzRoleApp.Catalog
	RoleDirectory               authzRoleApp.Directory
	PermissionCommands          authzPolicyApp.PermissionCommands
	PermissionReader            authzPolicyApp.PermissionReader
	RoleBindingCommands         authzRolebindingApp.Commands
	RoleBindingDirectory        authzRolebindingApp.Directory
	RouteAuthorization          authn.RouteAuthorizationRuntime
	RuntimeHealth               AuthzRuntimeHealthReporter
	AuthorizationChecker        *authzAuthorizationApp.Checker
	AuthorizationSnapshotReader *authzAuthorizationApp.SnapshotReader
}

type AuthzModule

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

AuthzModule 授权模块

func NewAuthzModule

func NewAuthzModule() *AuthzModule

NewAuthzModule 创建授权模块

func (*AuthzModule) ApplicationCapabilities

func (m *AuthzModule) ApplicationCapabilities() AuthzApplicationCapabilities

func (*AuthzModule) InitializeWithDeps

func (m *AuthzModule) InitializeWithDeps(deps AuthzModuleDeps) error

InitializeWithDeps 初始化授权模块。

func (*AuthzModule) RoleNameReader

func (m *AuthzModule) RoleNameReader() RoleNameReader

type AuthzModuleDeps

type AuthzModuleDeps struct {
	DB          *gorm.DB
	EventStager event.Stager
	ModelPath   string
}

type AuthzRuntimeHealthReporter

type AuthzRuntimeHealthReporter interface {
	ReloadHealth() (bool, error, time.Time)
}

type IDPApplicationCapabilities

type IDPApplicationCapabilities struct {
	WechatAppService           wechatapp.WechatAppApplicationService
	WechatAppCredentialService wechatapp.WechatAppCredentialApplicationService
	WechatAppTokenService      wechatapp.WechatAppTokenApplicationService
	WechatAppRepository        wechatappDomain.Repository
	SecretVault                wechatappDomain.SecretVault
}

type IDPModule

type IDPModule struct {
	// 应用服务(对外暴露)
	WechatAppService           wechatapp.WechatAppApplicationService
	WechatAppCredentialService wechatapp.WechatAppCredentialApplicationService
	WechatAppTokenService      wechatapp.WechatAppTokenApplicationService
	// 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) ApplicationCapabilities

func (m *IDPModule) ApplicationCapabilities() IDPApplicationCapabilities

func (*IDPModule) CacheFamilyInspectors

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

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

func (*IDPModule) InitializeWithDeps

func (m *IDPModule) InitializeWithDeps(deps IDPModuleDeps) error

InitializeWithDeps 初始化 IDP 模块。

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 IDPModuleDeps

type IDPModuleDeps struct {
	DB            *gorm.DB
	RedisClient   *redis.Client
	EncryptionKey []byte
}

type KeyRotationScheduler

type KeyRotationScheduler interface {
	Start(ctx context.Context) error
	Stop() error
	IsRunning() bool
	TriggerNow(ctx context.Context) error
}

KeyRotationScheduler is the runtime capability exposed by the authn module.

type RoleNameReader

type RoleNameReader interface {
	RoleNamesForSubject(ctx context.Context, subject authzDomain.Subject, tenantID string) ([]string, error)
}

type SuggestApplicationCapabilities

type SuggestApplicationCapabilities struct {
	Service appsuggest.ProfileSuggestor
}

type SuggestModule

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

SuggestModule 联想搜索模块

func NewSuggestModule

func NewSuggestModule() *SuggestModule

NewSuggestModule 创建模块

func (*SuggestModule) ApplicationCapabilities

func (m *SuggestModule) ApplicationCapabilities() SuggestApplicationCapabilities

func (*SuggestModule) CheckHealth

func (m *SuggestModule) CheckHealth() error

CheckHealth 检查是否已加载数据

func (*SuggestModule) Cleanup

func (m *SuggestModule) Cleanup() error

Cleanup 停止调度

func (*SuggestModule) InitializeWithDeps

func (m *SuggestModule) InitializeWithDeps(deps SuggestModuleDeps) error

InitializeWithDeps 初始化联想模块。

func (*SuggestModule) IsInitialized

func (m *SuggestModule) IsInitialized() bool

func (*SuggestModule) RuntimeCapabilities

func (m *SuggestModule) RuntimeCapabilities() SuggestRuntimeCapabilities

type SuggestModuleDeps

type SuggestModuleDeps struct {
	DB     *gorm.DB
	Config appsuggest.Config
}

type SuggestRuntimeCapabilities

type SuggestRuntimeCapabilities struct {
	Cleanup func() error
}

type UserApplicationCapabilities

type UserApplicationCapabilities struct {
	UserCreator          appuser.Creator
	UserEditor           appuser.Editor
	UserStatusChanger    appuser.StatusChanger
	UserDirectory        appuser.Directory
	ProfileDirectory     appprofile.Directory
	MyProfiles           appprofile.MyProfiles
	ProfileLinkCommands  appprofilelink.Commands
	ProfileLinkDirectory appprofilelink.Directory
	MyProfileLinks       appprofilelink.MyProfileLinks
	RoleNames            RoleNameReader
}

type UserModule

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

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

func NewUserModule

func NewUserModule() *UserModule

NewUserModule 创建用户模块

func (*UserModule) ApplicationCapabilities

func (m *UserModule) ApplicationCapabilities() UserApplicationCapabilities

func (*UserModule) CheckHealth

func (m *UserModule) CheckHealth() error

CheckHealth 检查模块健康状态

func (*UserModule) Cleanup

func (m *UserModule) Cleanup() error

Cleanup 清理模块资源

func (*UserModule) InitializeWithDeps

func (m *UserModule) InitializeWithDeps(deps UserModuleDeps) error

InitializeWithDeps 初始化用户模块。

type UserModuleDeps

type UserModuleDeps struct {
	DB             *gorm.DB
	RoleNames      RoleNameReader
	SessionManager sessiondomain.Manager
}

Jump to

Keyboard shortcuts

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