github.com/minio/console@v1.4.1/api/operations/auth/login_oauth2_auth.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  // LoginOauth2AuthHandlerFunc turns a function with the right signature into a login oauth2 auth handler
    32  type LoginOauth2AuthHandlerFunc func(LoginOauth2AuthParams) middleware.Responder
    33  
    34  // Handle executing the request and returning a response
    35  func (fn LoginOauth2AuthHandlerFunc) Handle(params LoginOauth2AuthParams) middleware.Responder {
    36  	return fn(params)
    37  }
    38  
    39  // LoginOauth2AuthHandler interface for that can handle valid login oauth2 auth params
    40  type LoginOauth2AuthHandler interface {
    41  	Handle(LoginOauth2AuthParams) middleware.Responder
    42  }
    43  
    44  // NewLoginOauth2Auth creates a new http.Handler for the login oauth2 auth operation
    45  func NewLoginOauth2Auth(ctx *middleware.Context, handler LoginOauth2AuthHandler) *LoginOauth2Auth {
    46  	return &LoginOauth2Auth{Context: ctx, Handler: handler}
    47  }
    48  
    49  /*
    50  	LoginOauth2Auth swagger:route POST /login/oauth2/auth Auth loginOauth2Auth
    51  
    52  Identity Provider oauth2 callback endpoint.
    53  */
    54  type LoginOauth2Auth struct {
    55  	Context *middleware.Context
    56  	Handler LoginOauth2AuthHandler
    57  }
    58  
    59  func (o *LoginOauth2Auth) 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 = NewLoginOauth2AuthParams()
    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  }