Documentation
¶
Index ¶
- Constants
- Variables
- func AccessLogMiddleware(next http.Handler) http.Handler
- func Authenticate(r *http.Request) (string, *http.Request, error)
- func BuildPluginContext(r *http.Request) map[string]interface{}
- func CheckScope(claims jwt.MapClaims, required string) bool
- func DecodeTokenWithoutValidation(tokenStr string) (jwt.MapClaims, error)
- func GetConfig() config.Config
- func IsAllowedFunction(item string) bool
- func LoadDBPlugins()
- func ParseCSV(s string) []string
- func ParseWhereClause(values map[string][]string, flatCtx map[string]string, ...) (map[string]interface{}, error)
- func Run()
- func SetConfig(newConfig config.Config)
- func SetupRouter() *mux.Router
Constants ¶
View Source
const TokenClaimsKey contextKey = "tokenClaims"
Variables ¶
View Source
var ( DbPlugins = make(map[string]easyrest.DBPlugin) AllowedOps = map[string]string{ "eq": "=", "neq": "!=", "lt": "<", "lte": "<=", "gt": ">", "gte": ">=", "like": "LIKE", "ilike": "ILIKE", "is": "IS", "in": "IN", } )
Global configuration and dbPlugins loaded only once.
Functions ¶
func AccessLogMiddleware ¶ added in v0.1.1
AccessLogMiddleware logs incoming HTTP requests if enabled.
func Authenticate ¶
Authenticate extracts and validates the JWT token.
func BuildPluginContext ¶ added in v0.1.1
BuildPluginContext extracts context variables from the HTTP request.
func DecodeTokenWithoutValidation ¶
DecodeTokenWithoutValidation decodes a JWT token without validating its signature.
func IsAllowedFunction ¶ added in v0.1.1
IsAllowedFunction checks if the provided function name is allowed.
func LoadDBPlugins ¶ added in v0.1.1
func LoadDBPlugins()
LoadDBPlugins scans environment variables and initializes plugins.
func ParseWhereClause ¶ added in v0.1.1
func ParseWhereClause(values map[string][]string, flatCtx map[string]string, pluginCtx map[string]interface{}) (map[string]interface{}, error)
ParseWhereClause converts query parameters starting with "where." into a map, performing context substitution for values.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.