MCPcopy Create free account
hub / github.com/crewjam/saml / HandleDeleteService

Method HandleDeleteService

samlidp/service.go:95–115  ·  view source on GitHub ↗

HandleDeleteService handles the `DELETE /services/:id` request.

(c web.C, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

93
94// HandleDeleteService handles the `DELETE /services/:id` request.
95func (s *Server) HandleDeleteService(c web.C, w http.ResponseWriter, r *http.Request) {
96 service := Service{}
97 err := s.Store.Get(fmt.Sprintf("/services/%s", c.URLParams["id"]), &service)
98 if err != nil {
99 s.logger.Printf("ERROR: %s", err)
100 http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
101 return
102 }
103
104 if err := s.Store.Delete(fmt.Sprintf("/services/%s", c.URLParams["id"])); err != nil {
105 s.logger.Printf("ERROR: %s", err)
106 http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
107 return
108 }
109
110 s.idpConfigMu.Lock()
111 delete(s.serviceProviders, service.Metadata.EntityID)
112 s.idpConfigMu.Unlock()
113
114 w.WriteHeader(http.StatusNoContent)
115}
116
117// initializeServices reads all the stored services and initializes the underlying
118// identity provider to accept them.

Callers

nothing calls this directly

Calls 4

PrintfMethod · 0.80
GetMethod · 0.65
DeleteMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected