Documentation ¶
Index ¶
- Variables
- func AllowPathPrefixSkipper(prefixes ...string) func(c echo.Context) bool
- func AuthFailedResp(c echo.Context, msg, obj, act string) error
- func CasbinAppMW(parserFn AppEnvParser, action string) echo.MiddlewareFunc
- func CasbinMiddleware(config CasbinConfig) echo.MiddlewareFunc
- func GrafanaAuthMW(next echo.HandlerFunc) echo.HandlerFunc
- func OpenAuth(next echo.HandlerFunc) echo.HandlerFunc
- func ParseAppEnvFromConfigID(c echo.Context) (appName, env string, err error)
- func ParseAppEnvFromContext(c echo.Context) (appName, env string, err error)
- func ProxyAuth(next echo.HandlerFunc) echo.HandlerFunc
- func ProxyGatewayMW(next echo.HandlerFunc) echo.HandlerFunc
- type AppEnvParser
- type Auth
- type CasbinConfig
- type OpenAuthCommonPayload
- type RedirectType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultConfig is the default CasbinAuth middleware config. DefaultConfig = CasbinConfig{ Skipper: middleware.DefaultSkipper, } )
View Source
var RedirectParam string = "return_url"
Functions ¶
func AllowPathPrefixSkipper ¶
func AuthFailedResp ¶
func CasbinAppMW ¶
func CasbinAppMW(parserFn AppEnvParser, action string) echo.MiddlewareFunc
func CasbinMiddleware ¶
func CasbinMiddleware(config CasbinConfig) echo.MiddlewareFunc
MiddlewareWithConfig returns a CasbinAuth middleware with config. See `CasbinMiddleware()`.
func GrafanaAuthMW ¶
func GrafanaAuthMW(next echo.HandlerFunc) echo.HandlerFunc
func ParseAppEnvFromConfigID ¶
ParseAppEnvFromConfigID 从
func ParseAppEnvFromContext ¶
ParseAppEnvFromContext 从Query/Body参数中获取应用环境信息
func ProxyGatewayMW ¶
func ProxyGatewayMW(next echo.HandlerFunc) echo.HandlerFunc
Types ¶
type AppEnvParser ¶
从 echo context 中获取 app 和 env 参数的函数
type Auth ¶
type Auth struct { Authenticator func(echo.Context) error }
func LoginAuth ¶
func LoginAuth(loginURL string, redirectType RedirectType) *Auth
type CasbinConfig ¶
type CasbinConfig struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper // Enforcer CasbinAuth main rule. // Required. Enforcer *casbin.SyncedEnforcer }
CasbinConfig defines the config for CasbinAuth middleware.
func (*CasbinConfig) CheckPermission ¶
CheckUserPermission checks the user/method/path combination from the request. Returns true (permission granted) or false (permission forbidden)
type OpenAuthCommonPayload ¶
type OpenAuthCommonPayload struct { AppID string `json:"app_id" query:"app_id" validate:"required"` Timestamp int64 `json:"timestamp" query:"timestamp" validate:"required"` NonceStr string `json:"nonce_str" query:"nonce_str" validate:"required"` Sign string `json:"sign" query:"sign" validate:"required"` }
type RedirectType ¶
type RedirectType string
const ( RedirectTypeHttp RedirectType = "http_redirect" RedirectTypeJson RedirectType = "json_redirect" )
Click to show internal directories.
Click to hide internal directories.