feat(ssf): 实现安全事件一键连接与凭据托管
新增数据库驱动的 SecurityEventConnectionManager,复用 RFC 7662 机器 Client,自动完成 Discovery、Push Bearer 生成、Stream 创建、Verification、首次启用、零停机轮换和安全退役。 增加文件与 Kubernetes SecretStore、最小权限 RBAC、动态 Receiver/撤销水位/内省降级,以及系统设置管理页面。已通过全量 Go 测试、go vet、关键包竞态测试、27 个 Web 测试、类型检查、生产构建、Compose 和 Kubernetes dry-run。
This commit is contained in:
@@ -75,13 +75,24 @@ func NewService(repository StateRepository, config ServiceConfig) (*Service, err
|
||||
}
|
||||
|
||||
func (s *Service) Start(ctx context.Context) error {
|
||||
if err := s.repository.EnsureSecurityEventStreamState(ctx, s.config.Issuer, s.config.Audience, s.config.StreamID); err != nil {
|
||||
if err := s.Initialize(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
go s.run(ctx)
|
||||
go s.Run(ctx)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Service) Initialize(ctx context.Context) error {
|
||||
return s.repository.EnsureSecurityEventStreamState(ctx, s.config.Issuer, s.config.Audience, s.config.StreamID)
|
||||
}
|
||||
|
||||
func (s *Service) Run(ctx context.Context) { s.run(ctx) }
|
||||
|
||||
// RequestVerification asks for an immediate verification without changing the
|
||||
// remote stream status. In particular, this never re-enables a stream paused
|
||||
// by an authentication-center administrator.
|
||||
func (s *Service) RequestVerification(ctx context.Context) { s.sendVerification(ctx) }
|
||||
|
||||
func (s *Service) Evaluate(ctx context.Context, identity auth.OIDCSecurityEventIdentity) (auth.OIDCSecurityEventEvaluation, error) {
|
||||
result, err := s.repository.EvaluateOIDCSecurityEvent(
|
||||
ctx, s.config.Issuer, s.config.Audience, identity.Issuer, identity.TenantID, identity.Subject,
|
||||
|
||||
Reference in New Issue
Block a user