-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
OCS APIs cannot be used in a straightforward way if OAuth-authenticated clients perform requests, due to CSRF checks. If a Bearer authentication header is present, it should be sufficient to assume that no CSRF attack takes place. As discussed below in this thread, it would be great if additional CSRF checks were disabled if requests are authenticated by a bearer token.
(Edited on 2017-08-07, 2:53 pm) -- Original Text:
If you add Nextcloud as an OAuth 2 service provider to a Moodle (3.3) installation, Moodle's OAuth API queries a
userinfo_endpointin order to obtain information about the authorising Nextcloud user. This fails since such an endpoint does not exist. Although actually from the OpenID spec, such an endpoint is useful to find out who was just logged in. It is also useful to check whether an access token is still valid without actually performing an operation on files. :)Specs for the userinfo endpoint: https://openid.net/specs/openid-connect-core-1_0.html#UserInfo (general) and https://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse (response).
Elements of the response can be: https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims, of which
subis a MUST (identifier of a Nextcloud user; what do you suggest? ID or username?). Moodle currently relies on a username and an email being present in the userinfo response. I already found out that you do not necessarily know an email adress, so I reported this there: https://tracker.moodle.org/browse/MDL-59511. I would suggest that you add an email address if it is known, instead of mocking one.