mirror of https://github.com/ehang-io/nps
add Proxy-Authirization on basic auth
parent
a59a0922ca
commit
29ec73c80b
|
@ -50,9 +50,12 @@ func DomainCheck(domain string) bool {
|
||||||
//Check if the Request request is validated
|
//Check if the Request request is validated
|
||||||
func CheckAuth(r *http.Request, user, passwd string) bool {
|
func CheckAuth(r *http.Request, user, passwd string) bool {
|
||||||
s := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
|
s := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
|
||||||
|
if len(s) != 2 {
|
||||||
|
s = strings.SplitN(r.Header.Get("Proxy-Authorization"), " ", 2)
|
||||||
if len(s) != 2 {
|
if len(s) != 2 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b, err := base64.StdEncoding.DecodeString(s[1])
|
b, err := base64.StdEncoding.DecodeString(s[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue