Documentation ¶
Index ¶
- Constants
- Variables
- func ConstantEtag() echo.MiddlewareFunc
- func SPAuth(passwords []string) echo.MiddlewareFunc
- func SPAuthWithConfig(config SPAuthConfig) echo.MiddlewareFunc
- func SinglePageApp(fallback string) echo.MiddlewareFunc
- func StreamId(next echo.HandlerFunc) echo.HandlerFunc
- type SPAuthConfig
- type SPAuthValidator
Constants ¶
View Source
const (
StreamIdKey = "stream-id"
)
Variables ¶
View Source
var AllowAllCors = middleware.CORSWithConfig(middleware.CORSConfig{ AllowOrigins: []string{"*"}, AllowHeaders: []string{"*", "Authorization"}, AllowMethods: []string{"*"}, ExposeHeaders: []string{"*"}, })
View Source
var ( // DefaultSPAuthConfig is the default SPAuth middleware config. DefaultSPAuthConfig = SPAuthConfig{ Skipper: middleware.DefaultSkipper, Expiration: expiration, } )
Functions ¶
func ConstantEtag ¶
func ConstantEtag() echo.MiddlewareFunc
ConstantEtag Static files in this project does not change until the server restarts. This middleware writes a constant eTag header into resp when serving static files.
func SPAuth ¶
func SPAuth(passwords []string) echo.MiddlewareFunc
SPAuth returns an SPAuth middleware.
Header example: Authorization: Bearer 00THIS00IS00A00HASH For valid credentials it calls the next handler. For missing or invalid credentials, it sends "401 - Unauthorized" response.
func SPAuthWithConfig ¶
func SPAuthWithConfig(config SPAuthConfig) echo.MiddlewareFunc
SPAuthWithConfig returns an SPAuth middleware with config. See `SPAuth()`.
func SinglePageApp ¶
func SinglePageApp(fallback string) echo.MiddlewareFunc
SinglePageApp acts like nginx try_files: {try_files $uri /index.html}
This is useful when serving a single page application
Types ¶
type SPAuthConfig ¶
type SPAuthConfig struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper Expiration time.Duration Passwords []string }
SPAuthConfig defines the config for SPAuth middleware.
Click to show internal directories.
Click to hide internal directories.