mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-01 09:52:23 -06:00
Merge pull request #5992 from owncloud/basic-auth-header
do not send www-authenticate basic for Api requests
This commit is contained in:
6
changelog/unreleased/www-authenticate-header.md
Normal file
6
changelog/unreleased/www-authenticate-header.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Bugfix: Fix authenticate headers for API requests
|
||||
|
||||
We changed the www-authenticate header which should not be sent when the `XMLHttpRequest` header is set.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/5992
|
||||
https://github.com/owncloud/ocis/issues/5986
|
||||
@@ -147,7 +147,9 @@ func configureSupportedChallenges(options Options) {
|
||||
func writeSupportedAuthenticateHeader(w http.ResponseWriter, r *http.Request) {
|
||||
caser := cases.Title(language.Und)
|
||||
for _, s := range SupportedAuthStrategies {
|
||||
w.Header().Add(WwwAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", caser.String(s), r.Host))
|
||||
if r.Header.Get("X-Requested-With") != "XMLHttpRequest" {
|
||||
w.Header().Add(WwwAuthenticate, fmt.Sprintf("%v realm=\"%s\", charset=\"UTF-8\"", caser.String(s), r.Host))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user