Refuse to service a service if auth setup failed

This commit is contained in:
Viktor Liu
2026-02-08 23:24:43 +08:00
parent 156d0b1fef
commit 7b6294b624
3 changed files with 523 additions and 6 deletions

View File

@@ -449,7 +449,10 @@ func (s *Server) updateMapping(ctx context.Context, mapping *proto.ProxyMapping)
}
maxSessionAge := time.Duration(mapping.GetAuth().GetMaxSessionAgeSeconds()) * time.Second
s.auth.AddDomain(mapping.GetDomain(), schemes, mapping.GetAuth().GetSessionKey(), maxSessionAge)
if err := s.auth.AddDomain(mapping.GetDomain(), schemes, mapping.GetAuth().GetSessionKey(), maxSessionAge); err != nil {
s.Logger.WithField("domain", mapping.GetDomain()).WithError(err).Error("Auth setup failed, refusing to serve domain without authentication")
return
}
s.proxy.AddMapping(s.protoToMapping(mapping))
}