Documentation
¶
Overview ¶
Package middleware contains HTTP middleware utilities
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WideOpen = CorsOptions{ Origin: "*", Methods: []string{"POST", "GET", "OPTIONS", "PUT", "UPDATE", "DELETE"}, Headers: []string{"Accept", "Content-Type", "Content-Length", "Accept-Encoding", "Authorization"}, ExposeHeaders: []string{"*"}, AllowCredentials: true, }
WideOpen is a preset configuration allowing unrestricted CORS access
Functions ¶
This section is empty.
Types ¶
type CorsMiddleware ¶
type CorsMiddleware struct {
Options CorsOptions
}
func (CorsMiddleware) BeforeNext ¶
func (cmw CorsMiddleware) BeforeNext(next http.Handler) http.Handler
type CorsOptions ¶
type CorsOptions struct { Origin string // Origin specifies the origin that is allowed to access the resource Methods []string // Methods is a list of HTTP methods allowed when accessing the resource Headers []string // Headers is a list of HTTP headers that can be used when making the actual request ExposeHeaders []string // ExposeHeaders indicates which headers are safe to expose to the API of a CORS API specification AllowCredentials bool // AllowCredentials indicates whether or not the response to the request can be exposed when the credentials flag is true }
CorsOptions defines the structure for CORS configuration options
type JWTBearerMiddleware ¶
type JWTBearerMiddleware struct { JWTService service.JsonWebTokenService Logger logging.Logger }
func (JWTBearerMiddleware) BeforeNext ¶
func (jwtmw JWTBearerMiddleware) BeforeNext(next http.Handler) http.Handler
type RequestLoggerMiddleware ¶
func (RequestLoggerMiddleware) BeforeNext ¶
func (rmw RequestLoggerMiddleware) BeforeNext(next http.Handler) http.Handler
Click to show internal directories.
Click to hide internal directories.