github.com/minio/console@v1.4.1/api/operations/auth/login.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // This file is part of MinIO Console Server 4 // Copyright (c) 2023 MinIO, Inc. 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU Affero General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU Affero General Public License for more details. 15 // 16 // You should have received a copy of the GNU Affero General Public License 17 // along with this program. If not, see <http://www.gnu.org/licenses/>. 18 // 19 20 package auth 21 22 // This file was generated by the swagger tool. 23 // Editing this file might prove futile when you re-run the generate command 24 25 import ( 26 "net/http" 27 28 "github.com/go-openapi/runtime/middleware" 29 ) 30 31 // LoginHandlerFunc turns a function with the right signature into a login handler 32 type LoginHandlerFunc func(LoginParams) middleware.Responder 33 34 // Handle executing the request and returning a response 35 func (fn LoginHandlerFunc) Handle(params LoginParams) middleware.Responder { 36 return fn(params) 37 } 38 39 // LoginHandler interface for that can handle valid login params 40 type LoginHandler interface { 41 Handle(LoginParams) middleware.Responder 42 } 43 44 // NewLogin creates a new http.Handler for the login operation 45 func NewLogin(ctx *middleware.Context, handler LoginHandler) *Login { 46 return &Login{Context: ctx, Handler: handler} 47 } 48 49 /* 50 Login swagger:route POST /login Auth login 51 52 Login to Console 53 */ 54 type Login struct { 55 Context *middleware.Context 56 Handler LoginHandler 57 } 58 59 func (o *Login) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 60 route, rCtx, _ := o.Context.RouteInfo(r) 61 if rCtx != nil { 62 *r = *rCtx 63 } 64 var Params = NewLoginParams() 65 if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 66 o.Context.Respond(rw, r, route.Produces, route, err) 67 return 68 } 69 70 res := o.Handler.Handle(Params) // actually handle the request 71 o.Context.Respond(rw, r, route.Produces, route, res) 72 73 }