mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
aac4c4772c
This allows overriding translation files in folders with lowercase RFC5646 / BCP47 Format language codes. This also fixes an issues where languages which don't expressly match the language code specified due to having a variant will also match the existing codes. Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
62 lines
2.2 KiB
Go
62 lines
2.2 KiB
Go
package middlewares
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/valyala/fasthttp"
|
|
)
|
|
|
|
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")
|
|
|
|
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 (
|
|
protoHTTPS = []byte("https")
|
|
protoHTTP = []byte("http")
|
|
|
|
// UserValueKeyBaseURL is the User Value key where we store the Base URL.
|
|
UserValueKeyBaseURL = []byte("base_url")
|
|
)
|
|
|
|
const (
|
|
headerValueXRequestedWithXHR = "XMLHttpRequest"
|
|
contentTypeApplicationJSON = "application/json"
|
|
contentTypeTextHTML = "text/html"
|
|
)
|
|
|
|
var okMessageBytes = []byte("{\"status\":\"OK\"}")
|
|
|
|
const (
|
|
messageOperationFailed = "Operation failed"
|
|
messageIdentityVerificationTokenAlreadyUsed = "The identity verification token has already been used"
|
|
messageIdentityVerificationTokenHasExpired = "The identity verification token has expired"
|
|
)
|
|
|
|
var protoHostSeparator = []byte("://")
|
|
|
|
var errPasswordPolicyNoMet = errors.New("the supplied password does not met the security policy")
|