소스 검색

Improve setup for multiple SCEP providers (slightly)

Herman Slatman 5 년 전
부모
커밋
165f6a1ccd
1개의 변경된 파일과 11개의 추가작업 그리고 2개의 파일을 삭제
  1. 11 2
      scep/api/api.go

+ 11 - 2
scep/api/api.go

@@ -178,9 +178,18 @@ type nextHTTP = func(http.ResponseWriter, *http.Request)
 func (h *Handler) lookupProvisioner(next nextHTTP) nextHTTP {
 	return func(w http.ResponseWriter, r *http.Request) {
 
+		// name := chi.URLParam(r, "provisionerID")
+		// provisionerID, err := url.PathUnescape(name)
+		// if err != nil {
+		// 	api.WriteError(w, fmt.Errorf("error url unescaping provisioner id '%s'", name))
+		// 	return
+		// }
+
 		// TODO: make this configurable; and we might want to look at being able to provide multiple,
-		// like the actual ACME one? The below assumes a SCEP provider (scep/) called "scep1" exists.
-		p, err := h.Auth.LoadProvisionerByID("scep/scep1")
+		// like the ACME one? The below assumes a SCEP provider (scep/) called "scep1" exists.
+		provisionerID := "scep1"
+
+		p, err := h.Auth.LoadProvisionerByID("scep/" + provisionerID)
 		if err != nil {
 			api.WriteError(w, err)
 			return