github.com/rsampaio/docker@v0.7.2-0.20150827203920-fdc73cc3fc31/api/server/auth.go (about) 1 package server 2 3 import ( 4 "encoding/json" 5 "net/http" 6 7 "github.com/docker/docker/api/types" 8 "github.com/docker/docker/cliconfig" 9 "github.com/docker/docker/pkg/version" 10 ) 11 12 func (s *Server) postAuth(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { 13 var config *cliconfig.AuthConfig 14 err := json.NewDecoder(r.Body).Decode(&config) 15 r.Body.Close() 16 if err != nil { 17 return err 18 } 19 status, err := s.daemon.RegistryService.Auth(config) 20 if err != nil { 21 return err 22 } 23 return writeJSON(w, http.StatusOK, &types.AuthResponse{ 24 Status: status, 25 }) 26 }