MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / Validate

Method Validate

auth/cert.go:96–112  ·  view source on GitHub ↗
(ctx context.Context, wr http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

94}
95
96func (auth *CertAuth) Validate(ctx context.Context, wr http.ResponseWriter, req *http.Request) (string, bool) {
97 if req.TLS == nil || len(req.TLS.VerifiedChains) < 1 || len(req.TLS.VerifiedChains[0]) < 1 {
98 return auth.handleReject(ctx, wr, req)
99 }
100 eeCert := req.TLS.VerifiedChains[0][0]
101 if auth.blacklist.Load().file.Has(eeCert.SerialNumber) {
102 return auth.handleReject(ctx, wr, req)
103 }
104 if auth.next != nil {
105 return auth.next.Validate(ctx, wr, req)
106 }
107 return fmt.Sprintf(
108 "Subject: %s, Serial Number: %s",
109 eeCert.Subject.String(),
110 formatSerial(eeCert.SerialNumber),
111 ), true
112}
113
114func (auth *CertAuth) Close() error {
115 var err error

Callers

nothing calls this directly

Calls 5

handleRejectMethod · 0.95
formatSerialFunction · 0.85
ValidateMethod · 0.65
HasMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected