mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-03 06:45:49 +00:00
ipn/ipnlocal: add profile pic header to serve HTTP proxy
Fixes #8807 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
parent
c56e94af2d
commit
49896cbdfa
@ -499,6 +499,7 @@ func (b *LocalBackend) addTailscaleIdentityHeaders(r *httputil.ProxyRequest) {
|
|||||||
// Clear any incoming values squatting in the headers.
|
// Clear any incoming values squatting in the headers.
|
||||||
r.Out.Header.Del("Tailscale-User-Login")
|
r.Out.Header.Del("Tailscale-User-Login")
|
||||||
r.Out.Header.Del("Tailscale-User-Name")
|
r.Out.Header.Del("Tailscale-User-Name")
|
||||||
|
r.Out.Header.Del("Tailscale-User-Profile-Pic")
|
||||||
r.Out.Header.Del("Tailscale-Headers-Info")
|
r.Out.Header.Del("Tailscale-Headers-Info")
|
||||||
|
|
||||||
c, ok := getServeHTTPContext(r.Out)
|
c, ok := getServeHTTPContext(r.Out)
|
||||||
@ -516,6 +517,7 @@ func (b *LocalBackend) addTailscaleIdentityHeaders(r *httputil.ProxyRequest) {
|
|||||||
}
|
}
|
||||||
r.Out.Header.Set("Tailscale-User-Login", user.LoginName)
|
r.Out.Header.Set("Tailscale-User-Login", user.LoginName)
|
||||||
r.Out.Header.Set("Tailscale-User-Name", user.DisplayName)
|
r.Out.Header.Set("Tailscale-User-Name", user.DisplayName)
|
||||||
|
r.Out.Header.Set("Tailscale-User-Profile-Pic", user.ProfilePicURL)
|
||||||
r.Out.Header.Set("Tailscale-Headers-Info", "https://tailscale.com/s/serve-headers")
|
r.Out.Header.Set("Tailscale-Headers-Info", "https://tailscale.com/s/serve-headers")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +197,7 @@ func TestServeHTTPProxy(t *testing.T) {
|
|||||||
tailcfg.UserID(1): {
|
tailcfg.UserID(1): {
|
||||||
LoginName: "someone@example.com",
|
LoginName: "someone@example.com",
|
||||||
DisplayName: "Some One",
|
DisplayName: "Some One",
|
||||||
|
ProfilePicURL: "https://example.com/photo.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -253,6 +254,7 @@ func TestServeHTTPProxy(t *testing.T) {
|
|||||||
{"X-Forwarded-For", "100.150.151.152"},
|
{"X-Forwarded-For", "100.150.151.152"},
|
||||||
{"Tailscale-User-Login", "someone@example.com"},
|
{"Tailscale-User-Login", "someone@example.com"},
|
||||||
{"Tailscale-User-Name", "Some One"},
|
{"Tailscale-User-Name", "Some One"},
|
||||||
|
{"Tailscale-User-Profile-Pic", "https://example.com/photo.jpg"},
|
||||||
{"Tailscale-Headers-Info", "https://tailscale.com/s/serve-headers"},
|
{"Tailscale-Headers-Info", "https://tailscale.com/s/serve-headers"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -264,6 +266,7 @@ func TestServeHTTPProxy(t *testing.T) {
|
|||||||
{"X-Forwarded-For", "100.150.151.153"},
|
{"X-Forwarded-For", "100.150.151.153"},
|
||||||
{"Tailscale-User-Login", ""},
|
{"Tailscale-User-Login", ""},
|
||||||
{"Tailscale-User-Name", ""},
|
{"Tailscale-User-Name", ""},
|
||||||
|
{"Tailscale-User-Profile-Pic", ""},
|
||||||
{"Tailscale-Headers-Info", ""},
|
{"Tailscale-Headers-Info", ""},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -275,6 +278,7 @@ func TestServeHTTPProxy(t *testing.T) {
|
|||||||
{"X-Forwarded-For", "100.160.161.162"},
|
{"X-Forwarded-For", "100.160.161.162"},
|
||||||
{"Tailscale-User-Login", ""},
|
{"Tailscale-User-Login", ""},
|
||||||
{"Tailscale-User-Name", ""},
|
{"Tailscale-User-Name", ""},
|
||||||
|
{"Tailscale-User-Profile-Pic", ""},
|
||||||
{"Tailscale-Headers-Info", ""},
|
{"Tailscale-Headers-Info", ""},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user