// Get handles all SCEP GET requests
Get handles all SCEP GET requests
// Get handles all SCEP GET requests
func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
	request, err := decodeSCEPRequest(r)
	if err != nil {
		writeError(w, errors.Wrap(err, "invalid scep get request"))
		return
	}
	ctx := r.Context()
	var response SCEPResponse
	switch request.Operation {
	case opnGetCACert:
		response, err = h.GetCACert(ctx)
	case opnGetCACaps:
		response, err = h.GetCACaps(ctx)
	case opnPKIOperation:
	default:
		err = errors.Errorf("unknown operation: %s", request.Operation)
	}
	if err != nil {
		writeError(w, errors.Wrap(err, "scep get request failed"))
		return
	}
	writeSCEPResponse(w, response)
}
func ( h * Handler ) Get ( w http . ResponseWriter , r * http . Request ) { request , err := decodeSCEPRequest ( r ) if err != nil { writeError ( w , errors . Wrap ( err , " " ) ) return } ctx := r . Context ( ) var response SCEPResponse switch request . Operation { case opnGetCACert : response , err = h . GetCACert ( ctx ) case opnGetCACaps : response , err = h . GetCACaps ( ctx ) case opnPKIOperation : default : err = errors . Errorf ( " " , request . Operation ) } if err != nil { writeError ( w , errors . Wrap ( err , " " ) ) return } writeSCEPResponse ( w , response ) }
Get handles all SCEP GET requests
Get handles all SCEP GET requests
// TODO: implement the GET for PKI operation? Default CACAPS doesn't specify this is in use, though