mirror of
https://github.com/owncloud/ocis
synced 2026-04-27 02:05:23 +02:00
rewrite the auth middleware
The old approach of the authentication middlewares had the problem that when an authenticator could not authenticate a request it would still send it to the next handler, in case that the next one can authenticate it. But if no authenticator could successfully authenticate the request, it would still be handled, which leads to unauthorized access.
This commit is contained in:
@@ -23,8 +23,6 @@ func TestBasicAuth__isPublicLink(t *testing.T) {
|
||||
{url: "/ocs/v1.php/cloud/capabilities", username: "public", expected: true},
|
||||
{url: "/ocs/v1.php/cloud/users/admin", username: "public", expected: false},
|
||||
}
|
||||
ba := basicAuth{}
|
||||
|
||||
for _, tt := range tests {
|
||||
req := httptest.NewRequest("", tt.url, nil)
|
||||
|
||||
@@ -32,7 +30,7 @@ func TestBasicAuth__isPublicLink(t *testing.T) {
|
||||
req.SetBasicAuth(tt.username, "")
|
||||
}
|
||||
|
||||
result := ba.isPublicLink(req)
|
||||
result := isPublicPath(req.URL.Path)
|
||||
if result != tt.expected {
|
||||
t.Errorf("with %s expected %t got %t", tt.url, tt.expected, result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user