Documentation
¶
Index ¶
- func RegisterRoutes(router *gin.Engine, basePath string, handlers *gotrust.GenericAuthHandlers)
- func WrapHandler(handler gotrust.HTTPHandler) gin.HandlerFunc
- func WrapMiddleware(middleware gotrust.HTTPMiddleware) gin.HandlerFunc
- type GinContext
- func (g *GinContext) Bind(dest interface{}) error
- func (g *GinContext) Context() context.Context
- func (g *GinContext) GetCookie(name string) (*http.Cookie, error)
- func (g *GinContext) GetFormValue(key string) string
- func (g *GinContext) GetHeader(key string) string
- func (g *GinContext) GetQueryParam(key string) string
- func (g *GinContext) JSON(code int, data interface{}) error
- func (g *GinContext) Redirect(code int, url string) error
- func (g *GinContext) SetCookie(cookie *http.Cookie)
- func (g *GinContext) SetHeader(key, value string)
- func (g *GinContext) SetStatus(code int)
- func (g *GinContext) String(code int, text string) error
- type GinRouter
- func (r *GinRouter) DELETE(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
- func (r *GinRouter) GET(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
- func (r *GinRouter) Group(prefix string, middleware ...gotrust.HTTPMiddleware) gotrust.Router
- func (r *GinRouter) POST(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
- func (r *GinRouter) PUT(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(router *gin.Engine, basePath string, handlers *gotrust.GenericAuthHandlers)
RegisterRoutes registers all auth routes on a Gin engine
func WrapHandler ¶
func WrapHandler(handler gotrust.HTTPHandler) gin.HandlerFunc
WrapHandler converts a gotrust.HTTPHandler to gin.HandlerFunc
func WrapMiddleware ¶
func WrapMiddleware(middleware gotrust.HTTPMiddleware) gin.HandlerFunc
WrapMiddleware converts a gotrust.HTTPMiddleware to gin.HandlerFunc
Types ¶
type GinContext ¶
GinContext wraps gin.Context to implement gotrust.HTTPContext
func (*GinContext) Bind ¶
func (g *GinContext) Bind(dest interface{}) error
Bind decodes request body
func (*GinContext) Context ¶
func (g *GinContext) Context() context.Context
Context returns the request context
func (*GinContext) GetCookie ¶
func (g *GinContext) GetCookie(name string) (*http.Cookie, error)
GetCookie gets a cookie
func (*GinContext) GetFormValue ¶
func (g *GinContext) GetFormValue(key string) string
GetFormValue gets a form value
func (*GinContext) GetHeader ¶
func (g *GinContext) GetHeader(key string) string
GetHeader gets a request header
func (*GinContext) GetQueryParam ¶
func (g *GinContext) GetQueryParam(key string) string
GetQueryParam gets a query parameter
func (*GinContext) JSON ¶
func (g *GinContext) JSON(code int, data interface{}) error
JSON sends a JSON response
func (*GinContext) Redirect ¶
func (g *GinContext) Redirect(code int, url string) error
Redirect sends a redirect response
func (*GinContext) SetCookie ¶
func (g *GinContext) SetCookie(cookie *http.Cookie)
SetCookie sets a cookie
func (*GinContext) SetHeader ¶
func (g *GinContext) SetHeader(key, value string)
SetHeader sets a response header
func (*GinContext) SetStatus ¶
func (g *GinContext) SetStatus(code int)
SetStatus sets the response status code
type GinRouter ¶
type GinRouter struct {
// contains filtered or unexported fields
}
GinRouter wraps gin.RouterGroup to implement gotrust.Router
func NewGinRouter ¶
func NewGinRouter(group *gin.RouterGroup) *GinRouter
NewGinRouter creates a new Gin router wrapper
func (*GinRouter) DELETE ¶
func (r *GinRouter) DELETE(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
DELETE registers a DELETE route
func (*GinRouter) GET ¶
func (r *GinRouter) GET(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
GET registers a GET route
func (*GinRouter) POST ¶
func (r *GinRouter) POST(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
POST registers a POST route
func (*GinRouter) PUT ¶
func (r *GinRouter) PUT(path string, handler gotrust.HTTPHandler, middleware ...gotrust.HTTPMiddleware)
PUT registers a PUT route