use the account.id as ocis userid, tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2020-10-27 14:33:51 +01:00
parent 8af7d0979e
commit 6f46e1bccb
5 changed files with 6 additions and 9 deletions

View File

@@ -81,7 +81,7 @@ Feature: auth
| endpoint |
| /ocs/v1.php/cloud/users |
| /ocs/v2.php/cloud/users |
Then the HTTP status code of responses on all endpoints should be "200"
Then the HTTP status code of responses on all endpoints should be "401"
And the OCS status code of responses on all endpoints should be "997"
When the user "Alice" requests these endpoints with "GET" with basic auth
| endpoint |

View File

@@ -26,7 +26,7 @@ Feature: auth
| /ocs/v1.php/privatedata/setattribute/testing/test |
| /ocs/v2.php/privatedata/setattribute/testing/test |
Then the HTTP status code of responses on all endpoints should be "401"
And the OCS status code of responses on all endpoints should be "997"
And the OCS status code of responses on all endpoints should be "notset"
# after fixing all issues delete this Scenario and use the one from oC10 core
Scenario: send POST requests to OCS endpoints as normal user with wrong password

View File

@@ -10,7 +10,7 @@ Feature: auth
| /ocs/v1.php/apps/files_sharing/api/v1/shares/123 |
| /ocs/v2.php/apps/files_sharing/api/v1/shares/123 |
Then the HTTP status code of responses on all endpoints should be "401"
And the OCS status code of responses on all endpoints should be "997"
And the OCS status code of responses on all endpoints should be "notset"
@issue-ocis-reva-30
@issue-ocis-ocs-26

View File

@@ -55,7 +55,7 @@ func (o Ocs) GetSelf(w http.ResponseWriter, r *http.Request) {
o.logger.Debug().Interface("account", account).Msg("got user")
d := &data.User{
UserID: account.PreferredName,
UserID: account.Id,
DisplayName: account.DisplayName,
LegacyDisplayName: account.DisplayName,
Email: account.Mail,
@@ -103,7 +103,7 @@ func (o Ocs) GetUser(w http.ResponseWriter, r *http.Request) {
}
d := &data.User{
UserID: account.PreferredName,
UserID: account.Id,
DisplayName: account.DisplayName,
LegacyDisplayName: account.DisplayName,
Email: account.Mail,

View File

@@ -99,11 +99,8 @@ func AccountUUID(opts ...Option) func(next http.Handler) http.Handler {
Iss: opt.OIDCIss,
}
} else {
// we are still forwarding the request, the service is responsible for rendering the error
// TODO or render a full blown ocs xml / json error response
next.ServeHTTP(w, r)
// tell client to reauthenticate
//w.WriteHeader(http.StatusUnauthorized)
w.WriteHeader(http.StatusUnauthorized)
return
}
} else {