2015-07-28 14:35:24 -04:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/cliconfig"
|
2015-09-09 17:14:09 -04:00
|
|
|
"github.com/docker/docker/context"
|
2015-07-28 14:35:24 -04:00
|
|
|
)
|
|
|
|
|
2015-08-31 10:55:51 -04:00
|
|
|
func (s *Server) postAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
2015-07-28 14:35:24 -04:00
|
|
|
var config *cliconfig.AuthConfig
|
|
|
|
err := json.NewDecoder(r.Body).Decode(&config)
|
|
|
|
r.Body.Close()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
status, err := s.daemon.RegistryService.Auth(config)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return writeJSON(w, http.StatusOK, &types.AuthResponse{
|
|
|
|
Status: status,
|
|
|
|
})
|
|
|
|
}
|