certauth.go
func (a *Auth) Handler(h http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// Let secure process the request. If it returns an error,
		// that indicates the request should not continue.
		if err := a.Process(w, r); err != nil {
			// if process returned an error request should not continue
			return
		}

		ctx := r.Context()
		if len(a.opt.AllowedOUs) > 0 {
			ctx = context.WithValue(ctx, HasAuthorizedOU, r.TLS.VerifiedChains[0][0].Subject.OrganizationalUnit)
		}

		if len(a.opt.AllowedCNs) > 0 {
			ctx = context.WithValue(ctx, HasAuthorizedCN, r.TLS.VerifiedChains[0][0].Subject.CommonName)
		}

		h.ServeHTTP(w, r.WithContext(ctx))
	})
}
func (a *Auth) Handler(h http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// Let secure process the request. If it returns an error,
		// that indicates the request should not continue.
		if err := a.Process(w, r); err != nil {
			// if process returned an error request should not continue
			return
		}

		ctx := r.Context()
		if len(a.opt.AllowedOUs) > 0 {
			ctx = context.WithValue(ctx, HasAuthorizedOU, r.TLS.VerifiedChains[0][0].Subject.OrganizationalUnit)
		}

		if len(a.opt.AllowedCNs) > 0 {
			ctx = context.WithValue(ctx, HasAuthorizedCN, r.TLS.VerifiedChains[0][0].Subject.CommonName)
		}

		h.ServeHTTP(w, r.WithContext(ctx))
	})
}
// Handler implements the http.HandlerFunc for integration with the standard net/http lib.