@@ -31,6 +31,7 @@ type CertAuth struct {
3131 logger * clog.CondLogger
3232 stopOnce sync.Once
3333 stopChan chan struct {}
34+ next Auth
3435}
3536
3637func NewCertAuth (param_url * url.URL , logger * clog.CondLogger ) (* CertAuth , error ) {
@@ -62,11 +63,18 @@ func NewCertAuth(param_url *url.URL, logger *clog.CondLogger) (*CertAuth, error)
6263 go auth .reloadLoop (reloadInterval )
6364 }
6465 }
66+ if nextAuth := values .Get ("next" ); nextAuth != "" {
67+ nap , err := NewAuth (nextAuth , logger )
68+ if err != nil {
69+ return nil , fmt .Errorf ("chained auth provider construction failed: %w" , err )
70+ }
71+ auth .next = nap
72+ }
6573
6674 return auth , nil
6775}
6876
69- func (auth * CertAuth ) Validate (_ context.Context , wr http.ResponseWriter , req * http.Request ) (string , bool ) {
77+ func (auth * CertAuth ) Validate (ctx context.Context , wr http.ResponseWriter , req * http.Request ) (string , bool ) {
7078 if req .TLS == nil || len (req .TLS .VerifiedChains ) < 1 || len (req .TLS .VerifiedChains [0 ]) < 1 {
7179 http .Error (wr , BAD_REQ_MSG , http .StatusBadRequest )
7280 return "" , false
@@ -76,6 +84,9 @@ func (auth *CertAuth) Validate(_ context.Context, wr http.ResponseWriter, req *h
7684 http .Error (wr , BAD_REQ_MSG , http .StatusBadRequest )
7785 return "" , false
7886 }
87+ if auth .next != nil {
88+ return auth .next .Validate (ctx , wr , req )
89+ }
7990 return fmt .Sprintf (
8091 "Subject: %s, Serial Number: %s" ,
8192 eeCert .Subject .String (),
0 commit comments