zrok/rest_server_zrok/operations/share/oauth_authenticate.go

57 lines
1.7 KiB
Go
Raw Normal View History

// Code generated by go-swagger; DO NOT EDIT.
package share
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// OauthAuthenticateHandlerFunc turns a function with the right signature into a oauth authenticate handler
type OauthAuthenticateHandlerFunc func(OauthAuthenticateParams) middleware.Responder
// Handle executing the request and returning a response
func (fn OauthAuthenticateHandlerFunc) Handle(params OauthAuthenticateParams) middleware.Responder {
return fn(params)
}
// OauthAuthenticateHandler interface for that can handle valid oauth authenticate params
type OauthAuthenticateHandler interface {
Handle(OauthAuthenticateParams) middleware.Responder
}
// NewOauthAuthenticate creates a new http.Handler for the oauth authenticate operation
func NewOauthAuthenticate(ctx *middleware.Context, handler OauthAuthenticateHandler) *OauthAuthenticate {
return &OauthAuthenticate{Context: ctx, Handler: handler}
}
/*
OauthAuthenticate swagger:route GET /oauth/authorize share oauthAuthenticate
OauthAuthenticate oauth authenticate API
*/
type OauthAuthenticate struct {
Context *middleware.Context
Handler OauthAuthenticateHandler
}
func (o *OauthAuthenticate) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewOauthAuthenticateParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}