Documentation
¶
Index ¶
- Variables
- func ContentTypeCheckerMiddleware() echo.MiddlewareFunc
- func Hash(token string) string
- func New() (string, error)
- func TokenAuthMiddleware() echo.MiddlewareFunc
- func TokenAuthSkipper(c echo.Context) bool
- func TokenAuthWithConfig(config TokenAuthConfig) echo.MiddlewareFunc
- func TokenIdentify(token string) string
- func XPoweredByMiddleware() echo.MiddlewareFunc
- type ContentTypeCheckerConfig
- type TokenAuthConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultTokenAuthConfig = TokenAuthConfig{ Skipper: defaultSkipper, ContextKey: "remote_user", TokenLookup: "header:" + echo.HeaderAuthorization, AuthScheme: "Token", } )
Functions ¶
func ContentTypeCheckerMiddleware ¶
func ContentTypeCheckerMiddleware() echo.MiddlewareFunc
func TokenAuthSkipper ¶
Skip request that's in NoneAuthUrls
func TokenAuthWithConfig ¶
func TokenAuthWithConfig(config TokenAuthConfig) echo.MiddlewareFunc
Add middleware of token with config
func XPoweredByMiddleware ¶
func XPoweredByMiddleware() echo.MiddlewareFunc
Types ¶
type ContentTypeCheckerConfig ¶
type ContentTypeCheckerConfig struct {
Skipper middleware.Skipper
}
var ( NoneJsonUrls map[string][]string = map[string][]string{ "ALL": []string{"/upload", "/download", "/thumb"}, } DefaultContentTypeCheckerConfig ContentTypeCheckerConfig = ContentTypeCheckerConfig{ Skipper: contentTypeCheckerSkipper, } )
type TokenAuthConfig ¶
type TokenAuthConfig struct {
Skipper middleware.Skipper
// Context key to store user information from the token into context.
// Optional. Default value "remote_user".
ContextKey string
// TokenLookup is a string in the form of "<source>:<name>" that is used
// to extract token from the request.
// Optional. Default value "header:Authorization".
// Possible values:
// - "header:<name>"
// - "query:<name>"
// - "cookie:<name>"
TokenLookup string
// AuthScheme to be used in the Authorization header.
// Optional. Default value "Token".
AuthScheme string
}
Click to show internal directories.
Click to hide internal directories.