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-11-05 13:06:05 +01:00
parent 8af7d0979e
commit 6f46e1bccb
5 changed files with 6 additions and 9 deletions
@@ -81,7 +81,7 @@ Feature: auth
| endpoint | | endpoint |
| /ocs/v1.php/cloud/users | | /ocs/v1.php/cloud/users |
| /ocs/v2.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" 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 When the user "Alice" requests these endpoints with "GET" with basic auth
| endpoint | | endpoint |
@@ -26,7 +26,7 @@ Feature: auth
| /ocs/v1.php/privatedata/setattribute/testing/test | | /ocs/v1.php/privatedata/setattribute/testing/test |
| /ocs/v2.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" 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 # 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 Scenario: send POST requests to OCS endpoints as normal user with wrong password
@@ -10,7 +10,7 @@ Feature: auth
| /ocs/v1.php/apps/files_sharing/api/v1/shares/123 | | /ocs/v1.php/apps/files_sharing/api/v1/shares/123 |
| /ocs/v2.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" 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-reva-30
@issue-ocis-ocs-26 @issue-ocis-ocs-26
+2 -2
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") o.logger.Debug().Interface("account", account).Msg("got user")
d := &data.User{ d := &data.User{
UserID: account.PreferredName, UserID: account.Id,
DisplayName: account.DisplayName, DisplayName: account.DisplayName,
LegacyDisplayName: account.DisplayName, LegacyDisplayName: account.DisplayName,
Email: account.Mail, Email: account.Mail,
@@ -103,7 +103,7 @@ func (o Ocs) GetUser(w http.ResponseWriter, r *http.Request) {
} }
d := &data.User{ d := &data.User{
UserID: account.PreferredName, UserID: account.Id,
DisplayName: account.DisplayName, DisplayName: account.DisplayName,
LegacyDisplayName: account.DisplayName, LegacyDisplayName: account.DisplayName,
Email: account.Mail, Email: account.Mail,
+1 -4
View File
@@ -99,11 +99,8 @@ func AccountUUID(opts ...Option) func(next http.Handler) http.Handler {
Iss: opt.OIDCIss, Iss: opt.OIDCIss,
} }
} else { } 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 // tell client to reauthenticate
//w.WriteHeader(http.StatusUnauthorized) w.WriteHeader(http.StatusUnauthorized)
return return
} }
} else { } else {