2019-04-24 21:52:08 +00:00
|
|
|
package middlewares
|
|
|
|
|
2021-12-02 02:21:46 +00:00
|
|
|
import (
|
2022-04-03 00:48:26 +00:00
|
|
|
"errors"
|
|
|
|
|
2021-12-02 02:21:46 +00:00
|
|
|
"github.com/valyala/fasthttp"
|
2021-07-22 03:52:37 +00:00
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
2021-12-02 02:21:46 +00:00
|
|
|
var (
|
|
|
|
headerXForwardedProto = []byte(fasthttp.HeaderXForwardedProto)
|
|
|
|
headerXForwardedHost = []byte(fasthttp.HeaderXForwardedHost)
|
|
|
|
headerXForwardedFor = []byte(fasthttp.HeaderXForwardedFor)
|
|
|
|
headerXRequestedWith = []byte(fasthttp.HeaderXRequestedWith)
|
|
|
|
headerAccept = []byte(fasthttp.HeaderAccept)
|
|
|
|
|
|
|
|
headerXForwardedURI = []byte("X-Forwarded-URI")
|
|
|
|
headerXOriginalURL = []byte("X-Original-URL")
|
|
|
|
headerXForwardedMethod = []byte("X-Forwarded-Method")
|
2022-02-06 13:37:28 +00:00
|
|
|
|
2022-03-04 04:46:12 +00:00
|
|
|
headerVary = []byte(fasthttp.HeaderVary)
|
|
|
|
headerOrigin = []byte(fasthttp.HeaderOrigin)
|
|
|
|
headerAccessControlAllowCredentials = []byte(fasthttp.HeaderAccessControlAllowCredentials)
|
|
|
|
headerAccessControlAllowHeaders = []byte(fasthttp.HeaderAccessControlAllowHeaders)
|
|
|
|
headerAccessControlAllowMethods = []byte(fasthttp.HeaderAccessControlAllowMethods)
|
|
|
|
headerAccessControlAllowOrigin = []byte(fasthttp.HeaderAccessControlAllowOrigin)
|
|
|
|
headerAccessControlMaxAge = []byte(fasthttp.HeaderAccessControlMaxAge)
|
|
|
|
headerAccessControlRequestHeaders = []byte(fasthttp.HeaderAccessControlRequestHeaders)
|
|
|
|
headerAccessControlRequestMethod = []byte(fasthttp.HeaderAccessControlRequestMethod)
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
headerValueFalse = []byte("false")
|
|
|
|
headerValueMaxAge = []byte("100")
|
|
|
|
headerValueVary = []byte("Accept-Encoding, Origin")
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-02-06 13:37:28 +00:00
|
|
|
protoHTTPS = []byte("https")
|
|
|
|
protoHTTP = []byte("http")
|
|
|
|
|
|
|
|
// UserValueKeyBaseURL is the User Value key where we store the Base URL.
|
|
|
|
UserValueKeyBaseURL = []byte("base_url")
|
2021-07-22 03:52:37 +00:00
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
2021-12-02 02:21:46 +00:00
|
|
|
headerValueXRequestedWithXHR = "XMLHttpRequest"
|
|
|
|
contentTypeApplicationJSON = "application/json"
|
|
|
|
contentTypeTextHTML = "text/html"
|
2021-07-22 03:52:37 +00:00
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
|
|
|
var okMessageBytes = []byte("{\"status\":\"OK\"}")
|
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
|
|
|
messageOperationFailed = "Operation failed"
|
|
|
|
messageIdentityVerificationTokenAlreadyUsed = "The identity verification token has already been used"
|
|
|
|
messageIdentityVerificationTokenHasExpired = "The identity verification token has expired"
|
|
|
|
)
|
2021-05-04 22:06:05 +00:00
|
|
|
|
|
|
|
var protoHostSeparator = []byte("://")
|
2022-04-03 00:48:26 +00:00
|
|
|
|
|
|
|
var errPasswordPolicyNoMet = errors.New("the supplied password does not met the security policy")
|