in proxy/lib/proxy/proxy.go [353:381]
func idToFhirHeader(id *ga4gh.Identity, removeScopes stringset.Set, r *http.Request) {
r.Header.Del(clientSecretHeader)
r.Header.Set(fhirTokenIDHeader, id.ID)
var authScope, consentScope []string
for _, scope := range strings.Split(id.Scope, " ") {
if len(scope) == 0 {
continue
}
if removeScopes.Contains(scope) {
continue
}
if consentScopePattern.MatchString(scope) {
consentScope = append(consentScope, scope)
} else {
authScope = append(authScope, scope)
}
}
if len(authScope) > 0 {
r.Header.Set(authScopeHeader, strings.Join(authScope, " "))
// TODO: consider always populating these headers.
r.Header.Set(fhirSubjectHeader, id.Subject)
r.Header.Set(fhirIssuerHeader, id.Issuer)
r.Header.Set(fhirPatientHeader, id.Patient)
}
if len(consentScope) > 0 {
r.Header.Set(consentScopeHeader, strings.Join(consentScope, " "))
}
}