mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-17 20:17:03 +02:00
Drop fallback to email when user is empty (#537)
This commit is contained in:
+6
-2
@@ -1048,10 +1048,14 @@ func (p *OAuthProxy) addHeadersForProxying(rw http.ResponseWriter, req *http.Req
|
||||
}
|
||||
}
|
||||
if p.SetBasicAuth {
|
||||
if session.User != "" {
|
||||
switch {
|
||||
case p.PreferEmailToUser && session.Email != "":
|
||||
authVal := b64.StdEncoding.EncodeToString([]byte(session.Email + ":" + p.BasicAuthPassword))
|
||||
rw.Header().Set("Authorization", "Basic "+authVal)
|
||||
case session.User != "":
|
||||
authVal := b64.StdEncoding.EncodeToString([]byte(session.User + ":" + p.BasicAuthPassword))
|
||||
rw.Header().Set("Authorization", "Basic "+authVal)
|
||||
} else {
|
||||
default:
|
||||
rw.Header().Del("Authorization")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user