fix: [AH-1237]: Fixing spaces in www-authenticate header (#3721)

* [AH-1237]: Fixing spaces in www-authenticate header
This commit is contained in:
Arvind Choudhary 2025-04-22 22:48:13 +00:00 committed by Harness
parent 0ba7be95fd
commit d493a9bf87

View File

@ -156,9 +156,9 @@ func getScope(r *http.Request) string {
}
func returnUnauthorised(ctx context.Context, w http.ResponseWriter, url string, scope string) {
header := fmt.Sprintf(`Bearer realm="%s", service="gitness-registry"`, url)
header := fmt.Sprintf(`Bearer realm="%s",service="gitness-registry"`, url)
if scope != "" {
header = fmt.Sprintf(`%s, scope="%s"`, header, scope)
header = fmt.Sprintf(`%s,scope="%s"`, header, scope)
}
w.Header().Set("WWW-Authenticate", header)
render.Unauthorized(ctx, w)