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

Method HandleGetUser

samlidp/user.go:43–53  ·  view source on GitHub ↗

HandleGetUser handles the `GET /users/:id` request and responds with the user object in JSON format. The HashedPassword field is excluded.

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

Source from the content-addressed store, hash-verified

41// HandleGetUser handles the `GET /users/:id` request and responds with the user object in JSON
42// format. The HashedPassword field is excluded.
43func (s *Server) HandleGetUser(c web.C, w http.ResponseWriter, r *http.Request) {
44 user := User{}
45 err := s.Store.Get(fmt.Sprintf("/users/%s", c.URLParams["id"]), &user)
46 if err != nil {
47 s.logger.Printf("ERROR: %s", err)
48 http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
49 return
50 }
51 user.HashedPassword = nil
52 json.NewEncoder(w).Encode(user)
53}
54
55// HandlePutUser handles the `PUT /users/:id` request. It accepts a JSON formatted user object in
56// the request body and stores it. If the PlaintextPassword field is present then it is hashed

Callers

nothing calls this directly

Calls 4

PrintfMethod · 0.80
GetMethod · 0.65
EncodeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected