Move authConfig from runtime to registry

Upstream-commit: 95dd6d31a4c11618836f9a55fc3dbbde48450b09
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-05-15 17:17:33 -07:00
parent d6276e6ddf
commit 2d208e56c7
6 changed files with 26 additions and 58 deletions
+3 -7
View File
@@ -45,11 +45,7 @@ func writeJson(w http.ResponseWriter, b []byte) {
}
func getAuth(srv *Server, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
config := &auth.AuthConfig{
Username: srv.runtime.authConfig.Username,
Email: srv.runtime.authConfig.Email,
}
b, err := json.Marshal(config)
b, err := json.Marshal(srv.registry.GetAuthConfig())
if err != nil {
return err
}
@@ -63,8 +59,8 @@ func postAuth(srv *Server, w http.ResponseWriter, r *http.Request, vars map[stri
return err
}
if config.Username == srv.runtime.authConfig.Username {
config.Password = srv.runtime.authConfig.Password
if config.Username == srv.registry.GetAuthConfig().Username {
config.Password = srv.registry.GetAuthConfig().Password
}
newAuthConfig := auth.NewAuthConfig(config.Username, config.Password, config.Email, srv.runtime.root)