routers

package
v0.0.0-...-6f9869b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

@APIVersion 1.0.0 @Title beego Test API @Description beego has a very cool tools to autogenerate documents for your API @Contact astaxie@gmail.com @TermsOfServiceUrl http://beego.me/ @License Apache 2.0 @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html

Index

Constants

This section is empty.

Variables

View Source
var FilterUser = func(ctx *context.Context) {

	req := ctx.Request
	requestURI := req.RequestURI
	method := req.Method

	if ((method == "GET" && len(requestURI) >= 13 && (requestURI[:13] == "/api/v1/proms" || requestURI[:13] == "/api/v1/rules")) ||
		(method == "POST" && len(requestURI) >= 14 && requestURI[:14] == "/api/v1/alerts")) &&
		ctx.Input.Header("Token") == "96smhbNpRguoJOCEKNrMqQ" {
		return
	}
	if len(requestURI) >= 14 && requestURI[:14] == "/api/v1/logout" {
		return
	}
	username, _ := ctx.Input.Session("username").(string)
	if username == "" && ctx.Request.RequestURI[:13] != "/api/v1/login" {
		_ = ctx.Output.JSON(common.Res{Code: -1, Msg: "Unauthorized"}, false, false)
	}
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL