Skip to content

Commit

Permalink
Fix setup of Dn HTTP header
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Jul 15, 2024
1 parent abaceb8 commit 4387a84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (a *CMSAuth) checkAuthentication(headers http.Header) bool {
prefix += fmt.Sprintf("h%xv%x", len(key), len(values[0]))
suffix += fmt.Sprintf("%s%s", key, values[0])
if strings.HasPrefix(key, "cms-authn") {
// here the new header "Dn" appears, i.e. cms-authn-dn => dn
headers[strings.Replace(key, "cms-authn-", "", 1)] = values
}
}
Expand Down Expand Up @@ -189,7 +190,6 @@ func setDNHeaders(r *http.Request, userData map[string]interface{}) {
if dnValue, ok := userData["dn"]; ok {
dn := dnValue.(string)
if r.Header.Get("Cms-Authn-Dn") != dn {
r.Header.Set("dn", dn)
r.Header.Set("cms-authn-dn", dn)
r.Header.Set("cms-auth-cert", dn)
}
Expand All @@ -199,7 +199,7 @@ func setDNHeaders(r *http.Request, userData map[string]interface{}) {
switch dns := val.(type) {
case []string:
for _, dn := range dns {
r.Header.Add("dns", dn)
r.Header.Add("Cms-DNs", dn)
}
}
}
Expand Down

0 comments on commit 4387a84

Please sign in to comment.