auth.go 580 B

1234567891011121314151617181920212223242526
  1. package server
  2. import (
  3. "encoding/json"
  4. "net/http"
  5. "github.com/docker/docker/api/types"
  6. "github.com/docker/docker/cliconfig"
  7. "golang.org/x/net/context"
  8. )
  9. func (s *Server) postAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
  10. var config *cliconfig.AuthConfig
  11. err := json.NewDecoder(r.Body).Decode(&config)
  12. r.Body.Close()
  13. if err != nil {
  14. return err
  15. }
  16. status, err := s.daemon.RegistryService.Auth(config)
  17. if err != nil {
  18. return err
  19. }
  20. return writeJSON(w, http.StatusOK, &types.AuthResponse{
  21. Status: status,
  22. })
  23. }