github.com/a4a881d4/docker@v1.9.0-rc2/api/server/router/local/auth.go (about)

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