From 0eba2989e06441eaf3615199d7c70d279bf322e2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 29 Oct 2025 17:42:53 +0100 Subject: [PATCH] api/types/registry: rename AuthenticateOKBody to AuthResponse Signed-off-by: Sebastiaan van Stijn --- api/docs/v1.52.yaml | 34 ++++++++++--------- api/swagger.yaml | 34 ++++++++++--------- api/types/registry/auth_response.go | 21 ++++++++++++ api/types/registry/authenticate.go | 21 ------------ client/login.go | 4 +-- daemon/server/router/system/system_routes.go | 2 +- hack/generate-swagger-api.sh | 4 +++ .../moby/api/types/registry/auth_response.go | 21 ++++++++++++ .../moby/api/types/registry/authenticate.go | 21 ------------ vendor/github.com/moby/moby/client/login.go | 4 +-- 10 files changed, 87 insertions(+), 79 deletions(-) create mode 100644 api/types/registry/auth_response.go delete mode 100644 api/types/registry/authenticate.go create mode 100644 vendor/github.com/moby/moby/api/types/registry/auth_response.go delete mode 100644 vendor/github.com/moby/moby/api/types/registry/authenticate.go diff --git a/api/docs/v1.52.yaml b/api/docs/v1.52.yaml index 1e7b789fd1..7c0d9a0b7d 100644 --- a/api/docs/v1.52.yaml +++ b/api/docs/v1.52.yaml @@ -2073,6 +2073,23 @@ definitions: password: "xxxx" serveraddress: "https://index.docker.io/v1/" + AuthResponse: + description: | + An identity token was generated successfully. + type: "object" + required: [Status] + properties: + Status: + description: "The status of the authentication" + type: "string" + example: "Login Succeeded" + x-nullable: false + IdentityToken: + description: "An opaque token used to authenticate a user after a successful login" + type: "string" + example: "9cbaf023786cd7..." + x-nullable: false + ProcessConfig: type: "object" properties: @@ -10023,22 +10040,7 @@ paths: 200: description: "An identity token was generated successfully." schema: - type: "object" - title: "SystemAuthResponse" - required: [Status] - properties: - Status: - description: "The status of the authentication" - type: "string" - x-nullable: false - IdentityToken: - description: "An opaque token used to authenticate a user after a successful login" - type: "string" - x-nullable: false - examples: - application/json: - Status: "Login Succeeded" - IdentityToken: "9cbaf023786cd7..." + $ref: "#/definitions/AuthResponse" 204: description: "No error" 401: diff --git a/api/swagger.yaml b/api/swagger.yaml index 1e7b789fd1..7c0d9a0b7d 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -2073,6 +2073,23 @@ definitions: password: "xxxx" serveraddress: "https://index.docker.io/v1/" + AuthResponse: + description: | + An identity token was generated successfully. + type: "object" + required: [Status] + properties: + Status: + description: "The status of the authentication" + type: "string" + example: "Login Succeeded" + x-nullable: false + IdentityToken: + description: "An opaque token used to authenticate a user after a successful login" + type: "string" + example: "9cbaf023786cd7..." + x-nullable: false + ProcessConfig: type: "object" properties: @@ -10023,22 +10040,7 @@ paths: 200: description: "An identity token was generated successfully." schema: - type: "object" - title: "SystemAuthResponse" - required: [Status] - properties: - Status: - description: "The status of the authentication" - type: "string" - x-nullable: false - IdentityToken: - description: "An opaque token used to authenticate a user after a successful login" - type: "string" - x-nullable: false - examples: - application/json: - Status: "Login Succeeded" - IdentityToken: "9cbaf023786cd7..." + $ref: "#/definitions/AuthResponse" 204: description: "No error" 401: diff --git a/api/types/registry/auth_response.go b/api/types/registry/auth_response.go new file mode 100644 index 0000000000..94c2e1bb36 --- /dev/null +++ b/api/types/registry/auth_response.go @@ -0,0 +1,21 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package registry + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// AuthResponse An identity token was generated successfully. +// +// swagger:model AuthResponse +type AuthResponse struct { + + // An opaque token used to authenticate a user after a successful login + // Example: 9cbaf023786cd7... + IdentityToken string `json:"IdentityToken,omitempty"` + + // The status of the authentication + // Example: Login Succeeded + // Required: true + Status string `json:"Status"` +} diff --git a/api/types/registry/authenticate.go b/api/types/registry/authenticate.go deleted file mode 100644 index 42cac4430a..0000000000 --- a/api/types/registry/authenticate.go +++ /dev/null @@ -1,21 +0,0 @@ -package registry - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/generate-swagger-api.sh -// ---------------------------------------------------------------------------- - -// AuthenticateOKBody authenticate o k body -// swagger:model AuthenticateOKBody -type AuthenticateOKBody struct { - - // An opaque token used to authenticate a user after a successful login - // Required: true - IdentityToken string `json:"IdentityToken"` - - // The status of the authentication - // Required: true - Status string `json:"Status"` -} diff --git a/client/login.go b/client/login.go index 6974ec22ce..b295080ab7 100644 --- a/client/login.go +++ b/client/login.go @@ -18,7 +18,7 @@ type RegistryLoginOptions struct { // RegistryLoginResult holds the result of a RegistryLogin query. type RegistryLoginResult struct { - Auth registry.AuthenticateOKBody + Auth registry.AuthResponse } // RegistryLogin authenticates the docker server with a given docker registry. @@ -39,7 +39,7 @@ func (cli *Client) RegistryLogin(ctx context.Context, options RegistryLoginOptio return RegistryLoginResult{}, err } - var response registry.AuthenticateOKBody + var response registry.AuthResponse err = json.NewDecoder(resp.Body).Decode(&response) return RegistryLoginResult{Auth: response}, err } diff --git a/daemon/server/router/system/system_routes.go b/daemon/server/router/system/system_routes.go index 49dbc6888f..a57e5d1e72 100644 --- a/daemon/server/router/system/system_routes.go +++ b/daemon/server/router/system/system_routes.go @@ -370,7 +370,7 @@ func (s *systemRouter) postAuth(ctx context.Context, w http.ResponseWriter, r *h if err != nil { return err } - return httputils.WriteJSON(w, http.StatusOK, ®istry.AuthenticateOKBody{ + return httputils.WriteJSON(w, http.StatusOK, ®istry.AuthResponse{ Status: "Login Succeeded", IdentityToken: token, }) diff --git a/hack/generate-swagger-api.sh b/hack/generate-swagger-api.sh index fd74929027..2e4661dd0c 100755 --- a/hack/generate-swagger-api.sh +++ b/hack/generate-swagger-api.sh @@ -84,6 +84,10 @@ generate_model types/plugin <<- 'EOT' PluginMount EOT +generate_model types/registry <<- 'EOT' + AuthResponse +EOT + generate_model types/storage <<- 'EOT' DriverData RootFSStorage diff --git a/vendor/github.com/moby/moby/api/types/registry/auth_response.go b/vendor/github.com/moby/moby/api/types/registry/auth_response.go new file mode 100644 index 0000000000..94c2e1bb36 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/registry/auth_response.go @@ -0,0 +1,21 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package registry + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// AuthResponse An identity token was generated successfully. +// +// swagger:model AuthResponse +type AuthResponse struct { + + // An opaque token used to authenticate a user after a successful login + // Example: 9cbaf023786cd7... + IdentityToken string `json:"IdentityToken,omitempty"` + + // The status of the authentication + // Example: Login Succeeded + // Required: true + Status string `json:"Status"` +} diff --git a/vendor/github.com/moby/moby/api/types/registry/authenticate.go b/vendor/github.com/moby/moby/api/types/registry/authenticate.go deleted file mode 100644 index 42cac4430a..0000000000 --- a/vendor/github.com/moby/moby/api/types/registry/authenticate.go +++ /dev/null @@ -1,21 +0,0 @@ -package registry - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/generate-swagger-api.sh -// ---------------------------------------------------------------------------- - -// AuthenticateOKBody authenticate o k body -// swagger:model AuthenticateOKBody -type AuthenticateOKBody struct { - - // An opaque token used to authenticate a user after a successful login - // Required: true - IdentityToken string `json:"IdentityToken"` - - // The status of the authentication - // Required: true - Status string `json:"Status"` -} diff --git a/vendor/github.com/moby/moby/client/login.go b/vendor/github.com/moby/moby/client/login.go index 6974ec22ce..b295080ab7 100644 --- a/vendor/github.com/moby/moby/client/login.go +++ b/vendor/github.com/moby/moby/client/login.go @@ -18,7 +18,7 @@ type RegistryLoginOptions struct { // RegistryLoginResult holds the result of a RegistryLogin query. type RegistryLoginResult struct { - Auth registry.AuthenticateOKBody + Auth registry.AuthResponse } // RegistryLogin authenticates the docker server with a given docker registry. @@ -39,7 +39,7 @@ func (cli *Client) RegistryLogin(ctx context.Context, options RegistryLoginOptio return RegistryLoginResult{}, err } - var response registry.AuthenticateOKBody + var response registry.AuthResponse err = json.NewDecoder(resp.Body).Decode(&response) return RegistryLoginResult{Auth: response}, err }