func (ca *CAServer) validateChallenge(typ, identifier string) {
	var err error
	switch typ {
	case "tls-alpn-01":
		err = ca.verifyALPNChallenge(identifier)
	default:
		panic(fmt.Sprintf("validation of %q is not implemented", typ))
	}
	ca.mu.Lock()
	defer ca.mu.Unlock()
	authz := ca.authorizations[identifier]
	if err != nil {
		authz.Status = "invalid"
	} else {
		authz.Status = "valid"
	}
	log.Printf("validated %q for %q; authz status is now: %s", typ, identifier, authz.Status)
	// Update all pending orders.
	// An order becomes "ready" if all authorizations are "valid".
	// An order becomes "invalid" if any authorization is "invalid".
	// Status changes: https://tools.ietf.org/html/rfc8555#section-7.1.6
OrdersLoop:
	for i, o := range ca.orders {
		if o.Status != acme.StatusPending {
			continue
		}
		var countValid int
		for _, zurl := range o.AuthzURLs {
			z, ok := ca.authorizations[path.Base(zurl)]
			if !ok {
				log.Printf("no authz %q for order %d", zurl, i)
				continue OrdersLoop
			}
			if z.Status == acme.StatusInvalid {
				o.Status = acme.StatusInvalid
				log.Printf("order %d is now invalid", i)
				continue OrdersLoop
			}
			if z.Status == acme.StatusValid {
				countValid++
			}
		}
		if countValid == len(o.AuthzURLs) {
			o.Status = acme.StatusReady
			o.FinalizeURL = ca.serverURL("/new-cert/%d", i)
			log.Printf("order %d is now ready", i)
		}
	}
}
// TODO: Only tls-alpn-01 is currently supported: implement http-01 and dns-01.
Only tls-alpn-01 is currently supported: implement http-01 and dns-01.
// TODO : Only tls - alpn - 01 is currently supported : implement http - 01 and dns - 01 .
func (ca *CAServer) validateChallenge(typ, identifier string) {
	var err error
	switch typ {
	case "tls-alpn-01":
		err = ca.verifyALPNChallenge(identifier)
	default:
		panic(fmt.Sprintf("validation of %q is not implemented", typ))
	}
	ca.mu.Lock()
	defer ca.mu.Unlock()
	authz := ca.authorizations[identifier]
	if err != nil {
		authz.Status = "invalid"
	} else {
		authz.Status = "valid"
	}
	log.Printf("validated %q for %q; authz status is now: %s", typ, identifier, authz.Status)
OrdersLoop:
	for i, o := range ca.orders {
		if o.Status != acme.StatusPending {
			continue
		}
		var countValid int
		for _, zurl := range o.AuthzURLs {
			z, ok := ca.authorizations[path.Base(zurl)]
			if !ok {
				log.Printf("no authz %q for order %d", zurl, i)
				continue OrdersLoop
			}
			if z.Status == acme.StatusInvalid {
				o.Status = acme.StatusInvalid
				log.Printf("order %d is now invalid", i)
				continue OrdersLoop
			}
			if z.Status == acme.StatusValid {
				countValid++
			}
		}
		if countValid == len(o.AuthzURLs) {
			o.Status = acme.StatusReady
			o.FinalizeURL = ca.serverURL("/new-cert/%d", i)
			log.Printf("order %d is now ready", i)
		}
	}
}
func ( ca * CAServer ) validateChallenge ( typ , identifier string ) { var err error switch typ { case " " : err = ca . verifyALPNChallenge ( identifier ) default : panic ( fmt . Sprintf ( " " , typ ) ) } ca . mu . Lock ( ) defer ca . mu . Unlock ( ) authz := ca . authorizations [ identifier ] if err != nil { authz . Status = " " } else { authz . Status = " " } log . Printf ( " " , typ , identifier , authz . Status ) OrdersLoop : for i , o := range ca . orders { if o . Status != acme . StatusPending { continue } var countValid int for _ , zurl := range o . AuthzURLs { z , ok := ca . authorizations [ path . Base ( zurl ) ] if ! ok { log . Printf ( " " , zurl , i ) continue OrdersLoop } if z . Status == acme . StatusInvalid { o . Status = acme . StatusInvalid log . Printf ( " " , i ) continue OrdersLoop } if z . Status == acme . StatusValid { countValid ++ } } if countValid == len ( o . AuthzURLs ) { o . Status = acme . StatusReady o . FinalizeURL = ca . serverURL ( " " , i ) log . Printf ( " " , i ) } } }
Only tls-alpn-01 is currently supported: implement http-01 and dns-01.
Only tls - alpn - 01 is currently supported : implement http - 01 and dns - 01 .
// Update all pending orders. // An order becomes "ready" if all authorizations are "valid". // An order becomes "invalid" if any authorization is "invalid". // Status changes: https://tools.ietf.org/html/rfc8555#section-7.1.6